You can use setmode(fileno(stdout), O_BINARY)
Wrap it in an ifdef if you want to keep it compatible with Linux.
See also: https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setmode?view=vs-2017
More Related Contents:
- Program gives unstable output? [closed]
- Removing trailing newline character from fgets() input
- How to send EOF via Windows terminal
- Print an int in binary representation using C
- How to list physical disks?
- How can I do a CPU cache flush in x86 Windows?
- How to overcome Stack Size issue with Visual Studio (running C codes with big array)
- system(“cd “) in a C program
- Sleep function in Windows, using C
- Does reading from stdin flush stdout?
- Using sys/socket.h functions on windows
- How to redirect the output back to the screen after freopen(“out.txt”, “a”, stdout)
- WinVerifyTrust to check for a specific signature?
- error C4996: ‘scanf’: This function or variable may be unsafe in c programming
- Conversion of Char to Binary in C
- Scanf/Printf double variable C
- How to buffer stdout in memory and write it from a dedicated thread
- C reverse bits in unsigned integer
- How to build a DLL from the command line in Windows using MSVC
- Why doesn’t C have binary literals?
- How can I convert a binary file to the text declaring a C/C++ array with that content?
- winapi: CreateProcess but hide the process’ window?
- Why does printf() not print anything before sleep()?
- LoadLibrary() an EXE?
- What does a “CALLBACK” declaration in C do?
- Copying content from a hidden or clipped window in XP?
- How to set up pthreads on windows?
- Can multithreading be implemented on a single processor system?
- Message “unknown type name ‘uint8_t'” in MinGW
- StackWalk64 on Windows – Get symbol name