I'm not sure how you are doing this, unless you are using Windows to write the file and looking at it in Linux.
On Windows, the EOL sequence is ^M^J (CRLF, or '\r\n').
On Linux it is just ^J (a single LF, or '\n').
If you want to make sure that the files you write do not have the '\r' character in them, make sure to open them with the std::ios::binary flag.
A word of caution, however: stick to using platform-native text file conventions. If you only use '\n' on Windows, people using your program will hate you, because your text files won't work properly on Windows. (Try and open a LF-only file with Notepad to see what happens.)
Most inter-systems programs are smart enough to perform the proper modifications when moving text files between platforms. What that means is that when your file was moved from Windows to Linux (assuming this is what happened) it was not properly converted to a Linux-text file. You can do this manually with the dos2unix utility.