Problem point & binary IO function FREAD (), fwrite ()

xiaoxiao2021-03-06  37

Problem point: 1. Transmission mode of PNG binary file 2. DAEMON asynchronous I / O achievement has been toned for a few days, or there is still no flock. *********************************************************** ***************** When reading and writing a file such as PNG, GIF images, we cannot read the ordinary read (), Write () function to read Document data, to use binary I / O functions FREAD (), fWrite (). / ******************************************************************** / # include size_t fread (void * PTR, SIZE_T SIZE, SIZE_T NOBJ, FILE * FP); SIZE_T FWRITE (const void * ptr, size_t size, size_t nobj, file * fp); / *************** ******************************** / EG: Char Data [20]; if (FREAD (& CHAR [2], SIZEOF (CHAR), 6, FP) ! = 6) {Printf ("FREAD ERROR / N"); exit (1);} FREAD and FWRITE returns the number of read or write objects. For reading, if an error or go to the end of the file, this number can be less than Nobj. At this time, should we call Ferror or FeOf to determine which situation, / **************************************** ******** / # include int Ferror (file * fp); int feed (file * fp); / **************** **************** / Two functions return: If the condition is true, it is not 0 (true), otherwise 0 (fake).

转载请注明原文地址:https://www.9cbs.com/read-73783.html

New Post(0)