The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 05-16-2008
gautamdheeraj gautamdheeraj is offline
Registered User
 

Join Date: Feb 2008
Posts: 18
This should work. You should check for read() > 0 instead of !=0.

Code:
while( (rv = read(fd2[0], line, MAXLINE)) > 0)
Usually for any file, socket, pipe and any other stream read, we should always read in a loop and check for various conditions.

- Dheeraj
Reply With Quote