I am always surprised when someone asks how to do a thing and then rejects the answer given.
Yes, there are other ways, but they would be a learning curve to about ten levels above what you now know.
But, back to the original question, you assume something that is not true:
because c++ 'thinks' mmm you are on a windows system |
If you are on a Windows system, then the C++ API will indeed translate the "\n" into a "\r\n".
If you are
not on a Windows system, then the C++ API will do what is correct for your system. On Linux systems, for example, it will translate the "\n" into a "\n".
If you find that this is not the case, then there is something wrong with your build system -- and the only way it got that way is because you did something odd to it. Are you trying to cross-compile something, perchance? Are you playing with the stream traits system after your program begins?
The simple answer remains -- if you want binary (==no LF translations) control you must use binary output streams. It isn't even hard -- you just add a single flag to your stream's iosflags state when you open it.
Hope this helps.