I need to print a newline character to a file with a C program running in windows and compiling with MinGW. However, it has to print \n
only, instead of \r\n
.
Take for example the following program:
#include <stdio>
void main() {
FILE * fid = fopen("out.txt", "w");
fprintf(fid, "\n");
fclose(fid);
}
Reading the created file in Matlab with the command:
text = int32(fileread('out.txt'))
Yields:
1x2 int32 row vector
13 10
Yet, somehow, I need it to print only 10
and not the 13
(=\r
) character.