On Windows this
#include
int main() {
putc(\'A\',stdout);
putc(\'\\r\',stdout);
putc(\'\\n\',stdout);
}
outp
A text file converts the C character '\n' into the native line ending on output, and converts the native line ending on input into a single '\n'.
To get the result you require, you'd have to change stdout into a binary file stream.
A partial answer is found here. If you have a C99-compliant library, using:
if (freopen(0, "wb", stdout) == 0)
...oops...operation failed...
will attempt to change standard output to a binary stream. However, on Windows, the 'C99-compliant library' might be a problem. Nominally, this is the portable (because standard) answer. There is likely a Windows-specific function to do the same job.