For this assignment i must replace all unprintable characters by escape sequences.
So, the program must do the following:
Read each character of the file, and
1) if that character has an escape sequence, print the escape sequence, even if the character is printable.
2) if the character is printable and has no escape sequence, print the character,
3) for all characters not covered by 1) or 2), print the escape sequence 0xhh, where hh is the hex representation of the byte. (You can print the hex value of a byte using the format item %02x in a printf statement. Here x means hex, 2 means print 2 characters, and the 0 means print leading zeros, so it will print 07 for seven, for example.)
When you get a new line character, send the escape code \ and n to the printer, and also send a new line character, represented in your program by its escape code \n, so that the output is divided into lines the same way as the original data.
Any ideas on how to get me started???