difference between text file and binary file

后端 未结 5 1678
执笔经年
执笔经年 2020-12-13 01:54

Why should we distinguish between text file and binary files when transmitting them? Why there are some channels designed only for textual data? At the bottom level, they ar

5条回答
  •  借酒劲吻你
    2020-12-13 02:33

    All machine language files are actually binary files.

    For opening a binary file, file mode has to be mentioned as "rb"or "wb"in fopen command. Otherwise all files are opened in default mode, which is text mode.

    It may be noted that text files can also be stored and processed as binary files but not viceversa.

    The binary files differ from text file in 2 ways:

    1. The storage of newline characters
    2. The EOF character

    Eg:

    • wt-t stands for textfile
    • Wb-b stands for binaryfile

    Binary files do not store any special character at the end either file end is verified by ueing their size itself.

提交回复
热议问题