Skip to content

Instantly share code, notes, and snippets.

View NoahDragon's full-sized avatar
I may be slow to respond.

Abner Chou NoahDragon

I may be slow to respond.
View GitHub Profile
@NoahDragon
NoahDragon / NonblockingReads.c
Last active February 3, 2016 21:51
Reading all the bytes from file-- from book "Linux System Programming"
/*
Snippet from: Linux System Programming
Purpose: read file to avoid system interuption
Relative: Nonblocking reads
*/
ssize_t ret;
while (len != 0 && (ret = read (fd, buf, len)) != 0 ) {
if(ret == -1){