The file types in C language are only ASCII files and binary files. ASCII code files are usually used to store input data and the final results of the program; binary files are used to temporarily store the intermediate results of the program for reading by another program.
#The file types in C language are only ASCII files and binary files.
(Recommended learning: C Language Tutorial)
Let’s take a look at the difference between ASCII code files and binary files:
1. Storage The format
binary file is stored according to the storage form of the data type in the memory;
text file is to convert the data type It is stored in a form that can be displayed on the screen;
2. Storage space
The ASCII storage method takes up more space and the size of the space is related to the size of the value. ;
3. Reading and writing time
ASCII code files are stored in ASCII code on the external storage, while the data in the memory are stored in binary, so when Conversion is required when reading and writing files, resulting in slower data access;
The data of binary files is stored in external memory according to its storage form in memory, and does not require conversion. So the access speed is faster.
4. Function
ASCII files can be created and modified through editing programs, such as edit, notepad, etc., and also It can be displayed through the TYPE command in DOS, so ASCII code files are usually used to store input data and the final results of the program;
binary files cannot be displayed, so they are used to temporarily store programs The intermediate result can be read by another program;
The above is the detailed content of What are the only two file types in C language?. For more information, please follow other related articles on the PHP Chinese website!