Files is collection of records (or) it is a place on hard disk, where data is stored permanently.
There are two types of files in C language which are as follows −
It contains alphabets and numbers which are easily understood by human beings.
An error in a text file can be eliminated when seen.
In text file, the text and characters will store one char per byte.
For example, the integer value 4567 will occupy 2 bytes in memory, but, it will occupy 5 bytes in text file.
The data format is usually line-oriented. Here, each line is a separate command.
It contains 1’s and 0’s, which are easily understood by computers.
The error in a binary file corrupts the file and is not easy to detect.
In binary file, the integer value 1245 will occupy 2 bytes in memory and in file.
A binary file always needs a matching software to read or write it.
For example, an MP3 file can be produced by a sound recorder or audio editor, and it can be played in a music player.
MP3 file will not play in an image viewer or a database software.