3 ms·
std::cout << "\n"; will emit \r\n on Windows by default.
by plorkyeran 4y ago
std::cout << "\n"; will emit \r\n on Windows by default.
- CoastalCoder 4y agoI wouldn't have expected that. Is it compiler-specific? Because it sounds totally broken, but maybe the language spec covers this and I didn't realize it.
- plorkyeran 4y agoSimilar to FTP, iostreams have a concept of text mode and binary mode for streams. In text mode, newlines are translated and in binary mode they are not. Which mode std::cout is in by default is implementation-defined just to be obnoxious. VC++ defaults to text mode.