Yes, you have to open the file in "binary" mode to stop the newline translation.
How you do it depends on how you are opening the file.
Using fopen
:
FILE* outfile = fopen( "filename", "wb" );
Using ofstream
:
std::ofstream outfile( "filename", std::ios_base::binary | std::ios_base::out );
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…