int fclose( std::FILE* stream );
Parameters
stream - the file stream to close
Return value
0 on success, EOF otherwise
文件写入函数
std::size_t fwrite( const void* buffer, std::size_t size, std::size_t count, std::FILE* stream );
Parameters
buffer - pointer to the first object object in the array to be written
size - size of each object in bytes
count - the number of the objects to be written
stream - output file stream to write to
Return value
Number of objects written successfully, which may be less than count if an error occurred.
If size or count is zero, fwrite returns zero and performs no other action.
文件读取函数
std::size_t fread( void* buffer, std::size_t size, std::size_t count, std::FILE* stream );
Parameters
buffer - pointer to the first object in the array to be read
size - size of each object in bytes
count - the number of the objects to be read
stream - input file stream to read from
Return value
Number of objects read successfully, which may be less than count if an error or end-of-file condition occurs.
If size or count is zero, fread returns zero and performs no other action.