I am writing a program in C that prints a random hexadecimal value to a text file. The printed value has a carriage return (CR) along with a line feed (LF). However, the CR (vis
Open/create the file in binary mode
file = fopen(tracefile, "wb"); ^ Binary mode
Otherwise
fprintf(file,"\n"); /* In text mode this appends two characters. */