Binary File text files and binary data
We know that the computer uses binary for computation, so everything stored in the computer is binary.
I also know this sentence, but why do I always hear people say "binary" files and "text" files? According to the above sentence, everything in the computer should be binary!
The underlying storage is binary "data" instead of binary files.
List a binary file as follows: 00000000 h: 0F 01 00 00 0F 03 00 00 12 53 21 45 58 62 35 34; ...... S! Exb542130010h: 41 42 43 44 45 46 48 49 47 4B 4C 4D 4E 4F 50; ABCDEFGHIGKLMNOP
I was totally confused when I saw this binary file. Shouldn't the binary file look like the one listed below?
The binary data stored at the underlying layer should be as follows:
00000000 00000001 10001010 11011101
The hard disk should all be stored in the category of "data. The file we usually talk about is at the operating system level.
Next we will explain the differences between a binary file and a text file:
When a file is considered to be composed of one byte, the maximum bit of each byte in the text file is 0, that is, the text file uses seven bits in one byte to represent all information, the binary file uses all bits in the bytes. This is the difference between the two. When an object is opened in text or binary mode, what is the difference between the two? In fact, both binary files and text files are a series of 0 and 1, but the opening method is different, and the processing of these 0 and 1 is also different. If you open the file in text mode, the file will be translated when it is opened, and each byte will be converted to an ASCII code. If you open the file in binary mode, the file will not be translated; the last step is to edit the text file and binary file in different ways. For example, when you edit text in notepad, the minimum unit for editing is byte. If you edit a binary file, the minimum unit is bit. Of course, we will not directly edit the binary file manually.
Through the above description, we should know what the binary file means!
The above content is a summary of my personal understanding. If there is anything wrong, please point it out.