So, i wrote a C program that loads in an ASCII file line-by-line using code like the below. This worked fine compiled down to windows and to ubuntu, but we tried to compile it onto a raspberry pi (which I think runs a variant of debian linux), it didnt process the file correctly. It seemed (but not sure) to be loading the entire file into one line; ie not detecting the '/n' as an end of line and loading the whole file into line_data.
We have double checked the data file, and they are each encoded properly (ie line endings) for the operating system.
So my questions are;
1) isn't '\n' supposed to be the portable way to detect an end of line?
2) if not, what IS the portable way?
Thanks for any help.
ch = getc(fp);
if (ch == EOF) done_reading = true;
if ((ch == '\n') || (ch == EOF))
// process the complete line in line_text
line_text[line_length] = ch;