The storage of computer data is physically binary, so the difference between a text file and a binary file is not physical storage.
Mainly lies inEncoding MethodThe text file is based onCharacter encodingFiles are commonly encoded in ASCII, Unicode, UTF-8, and binary format.Value-basedEncoded file
The fixed-length encoding of a text file (there are also non-fixed-length such as UTF-8 at present). The binary file is a side-Length Encoding. It is up to you to determine how many bits represent a value. This encoding method causesBinary will save more space
For example, 201710000_00000000_00000000_00000001
If it is displayed in notepad in ASCII encoding mode, it is null_null_null_soh.
In binary files, it is only 1 of the int type.
Binary files and text files are only encoded differently, so their advantages and disadvantages are the advantages and disadvantages of the encoding method.
The encoding of text files is based on the Character length, which makes decoding easier. binary files are longer encoded. Therefore, the encoding is flexible, the storage utilization is higher, and the decoding is more difficult (different binary file formats, there are different decoding methods), in space
For example, binary data can be expressed by one bit, but at least one character (1 byte) is required in text format)
The text mode and binary mode read and write operations are different only for line feed carriage returns. They have nothing to do with the file itself.
Original article: http://www.cnblogs.com/zhangjiankun/archive/2011/11/27/2265184.html
Differences between text files and binary files