I am writing code that runs in Windows and outputs a text file that later becomes the input to a program in Linux. This program behaves incorrectly when given files that hav
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:
fopen
FILE* outfile = fopen( "filename", "wb" );
Using ofstream:
ofstream
std::ofstream outfile( "filename", std::ios_base::binary | std::ios_base::out );