Let's say that I have a program that, so far, opens a TXT file and prints it back to the user.
I would like output of the read file to be formatted depending on what is read. For example, if 0x01 (Hex Value 01, yes) is read in the file, that is converted to \n (New Line function) and the final display to the user would be a new line.Code:#include <stdio.h> void main() { FILE *fopen(), *fp; int c; fp = fopen("text.txt","r+"); c = getc(fp) ; while (c!= EOF) { putchar(c); c = getc(fp); } fclose(fp); }
Example (text.txt):
"How are you today, Tom?" asked Tim.[0x01 Hex Character here.]"I'm well, Tim. Thanks. How are you, Tim?" asked Tom.
Would be displayed as:
"How are you today, Tom?" asked Tim.
"I'm well, Tim. Thanks. How are you, Tim?" asked Tom.
I look forward to any assistance I can get. Thanks!