更新时间:2021-09-01 00:56:33
MSVC解决方案是:
The MSVC solution is:
#include <io.h>
#include <fcntl.h>
...
_setmode(1,_O_BINARY)
其他运行时可能会提供C99解决方案或替代方法.我相信setmode([file number],O_BINARY)
起源于Borland Turbo C,并且其他用于MS-DOS和Windows的编译器都模仿了它.完成_前缀以保持命名空间整洁,某些编译器中可能不存在此前缀.
Other runtimes may provide the C99 solution or an alternate way. I believe setmode([file number],O_BINARY)
originated on Borland Turbo C, and other compilers for MS-DOS and Windows imitated it. The _ prefix is done to keep the namespace clean, and may not be present on some compilers.