News for hackers. Stuff that matters.
Re:What If I Don't Actually Like My Users? (2008) by pdkl95 on Thursday June 02, 2016 @11:35PM (#11828130)
gnulib has a decent set of safety wrappers around read(2)/write(2).

safe_rw() http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=li...

This handles a single read/write, handles EINTER, and returns the amount that was successfully read/written.

full_rw() http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=li...

A wrapper around safe_rw() that handles advancing the pointer through the buffer, calling safe_rw() until the requested COUNT bytes have been sent/received.

--

In most cases, I recommend avoiding all of this and using the existing fopen/fread/fwrite/etc buffered I/O interface.

There are no comments on this comment yet.