Fread reads nmemb elements from the file stream and writes them to the memory directed by PTR. The size of each element is size byte.
Fwrite reads nmemb elements from the memory directed by PTR and writes them to the file stream. Each element has size bytes.
All file read/write functions start to read and write from the current read/write point of the file. After reading, the current read/write point automatically moves the size * nmemb byte.
Gets () ignores '\ n'. If the program is executed, press enter, and the string stores' \ 0 '. If an error occurs or ends at the end of the file, null is returned.
Puts () will replace '\ 0' with \ N output. In case of an error, EOF is returned.
Fgets () returns the first address of the array, '\ n' is also saved, and an' \ 0' is added. If the object ends, null is returned. If an error occurs or ends at the end of the file, null is returned.
Fputs does not automatically add line breaks at the end of a row. In case of an error, EOF is returned.
Note: When reading strings from a file, '\ 0' D is automatically added to the end.
Writes formatted strings starting with F to the file stream, or reads formatted strings from the file stream.
Writes formatted strings starting with S to STR, or reads formatted strings from Str.
If you write a function, the number of written characters (not including '\ 0') is returned. If an error occurs, a negative number is returned.
For a READ function, the number of matched values is returned. If an error occurs or the end of the file is reached, EOF is returned.
Note: For read functions, spaces are ignored when matching strings, and '\ 0' is added at the end '.
The read and write functions are called in Linux and are only used in Linux. Not buffered.
Note:
For pipelines, the read return value can be in the following three situations:
1. Reading is normal. The number of characters read is returned.
2. The peer write end is disabled, and read returns 0.
3. Close your own read end. If a read error occurs,-1 is returned.
Note: When reading data to an Array Using read, '\ 0' is not automatically added to the end!
Use of Basic Input/Output Functions