Since you do not offer any kind of a start that you might have tried or any useful related information (e.g. Operating System)....I can only offer the general idea to have a look at the WriteEcel module, which has a protect() function.
have fun
the hardest line to type correctly is: stty erase ^H