>separated by '\n' or '\r\n', depending on the os
Don't you know that C automatically translate '\n' into the native newline character when files are opened in text mode?
Read http://en.wikipedia.org/wiki/Newline#Newline_in_programming_languages 2nd point.Hence you never need to bother what is the newline character of underlying implementation, just use '\n' all the way.
Yes of course I know that -- I was talking about what's on the disk, not what's in memory.