在windows中,text mode在写操作时会确保\n前面有个\r,在读操作时又会确保把\n前面的\r去掉。
On UNIX systems, binary and text modes
are the same.
On Windows systems, binary and text
modes are different. If you are unsure
which mode is best for your file, use
binary mode. By default, fopen opens
files for binary read access.
In binary mode, read and write
operations process all characters in
the same manner. In text mode:
- Read operations that encounter a carriage return followed by a newline
character remove the carriage return
from the input.
- Write operations insert a carriage return before any newline character in
the input.