I don't think I understood your question. If you could explain (in detail) I may be able to help you.
For instance, do you want to print "\r" (exactly) in your file, or are you talking about carriage return? what do you want to know?
Seems to me that it does append a newline CR+LF at the end of a string. So, you basically want to get rid of Carriage return? Well I don't know, but I think this program might help you.. try it
But I honestly admit that I don't know why it works,, at first I thought that binary mode might help so I just added the ios::binary, but I was expecting both CR+LF to be out of file, but though CR was absent, LF wasn't.
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
#include <fstream>
usingnamespace std;
int main()
{
ofstream out_file("something.txt",ios::out|ios::binary); //This results in 7 bytes
//Omitting ios::binary results in 8 bytes
bool label = false;
char ar[]="string";
out_file << ar << std::endl;
out_file.close();
}