C++ - Cross-platform newline character in string
As long as you read/write text streams, or files in text mode, \n
will be translated into the correct sequence for the platform.
http://en.cppreference.com/w/c/io
Another way to put it is that \n
is cross platform for the compiler. It will compile on all platforms and generate correct output for the platform. But the output is not really cross platform since new line in text is different on different platforms. So reading need extra handling to be platform independent.