I need to write text data to a memory-mapped file (using Boost). I have to do it in a raw mode, so I can't use boost::stream wrapper.
I want to write newline symbols in the text too. Obviously, I can't use text mode to rely on system \n conversion. I have to detect the correct \n representation on the given platform and write this sequence by myself.
The only way I could think of is to create a temp file, output \n to it in text mode and then reopen in a binary mode. But this approach is lame.
There is some API to directly query platform-dependent newline, isn't it?