Thinking about UNIX, Windows and Mac and an output stream (both binary and text),
What does std::endl
represent, i.e. <CR><LF>
, <LF>
or <CR>
? Or is it always the same no matter what platform/compiler?
The reason I'm asking is that I'm writing a TCP client that talks a protocol that expects each command to end in <CR><LF>
. So I'm wondering whether to use std::endl
or "\r\n"
in my streams.
EDIT: Ok, so one flushes the buffer and another doesn't. I get that. But if I'm outputting text to a file, is '\n'
equal to <LF>
or does it convert to <CR><LF>
on Windows and <LF>
on Unix or not? I don't see a clear answer yet.