Linux fread and fwrite 1. The function is used to read and write a data block. 2. the call method is fread (buffer, size, count, fp), fwrite (buffer, size, count, fp), and 3. description (1) buffer: A pointer. For fread, It is the storage address for reading data. For fwrite, It is the address of the data to be output. (2) size: the number of bytes to read and write; (3) count: the number of size bytes to read and write data items; (4) fp: file type pointer. 4. example: 1. fread (& id, f) refers to reading the value in f into id, reading 1 byte each time, reading 10 times in total, or reading all the values in id, it will also be stopped less than 10 times. 2. fwrite (& id, f) is to read the value in id into f, read 1 byte each time, read 10 times in total or fread (& id, 10, 1, f) it is to read the value in the id into it, and read 10 bytes each time for a total of 1 read. The difference between fread and read: 1. fread is buffered, and read is not buffered. 2. fopen is defined in standard c, and open is defined in POSIX. 3. fread can read a structure. in linux/unix, there is no difference between reading binary data and common files. 4. fopen cannot specify the permission to create a file. open allows you to specify permissions. 5. fopen returns the pointer and open returns the file descriptor (integer ). 6. If any device in linux/unix is a file, you can use open or read.