Printing a line feed char
-
This is in C...
I have the code: fprintf(fp, "%c", 10);
which prints the ascii 10 (line feed) into a file. But then when I view the file contents in Hex, it gives me 0D 0A... How do I just output the 0A and not the 0D?
-
You have to open the file in binary mode. i.e. change fopen("file", "w") into fopen("file", "wb")
-
Use Linux or Unix. :-)
-
Stupid default text mode. And of course to keep with backwards compatibility, this can never change :(