4 ms·
I can't say this is true in all cases, but I believe that fopen()/fread()/frwrite()/fclose() all cover this for you. You can get the file number for an opened
by ArkyBeagle 10y ago
I can't say this is true in all cases, but I believe that fopen()/fread()/frwrite()/fclose() all cover this for you.
You can get the file number for an opened FILE * block thru something like fileno() or filenum() or something.
The f() calls all buffer for you.
The problem is that write() is entangled in the ioctl() universe in many implementations of 'C' and that gets funky fast.
Beyond* that, reading and writing may involve making your own furniture to hide the ugly from dealing with peripherals.
- JoshTriplett 10y agoYou can also use fdopen to get a FILE* from a file descriptor, and then use the buffering and read/write logic of the C library, rather than having to write your own write_in_full function.