[cs631apue] HW3 grades
    Jan Schaumann 
    jschauma at stevens.edu
       
    Sat Nov  4 15:29:29 EDT 2017
    
    
  
Hello,
I've sent out HW3 grades.
As mentioned in class, I wasn't so much looking for a perfectly working
program (although some submissions were just that), but rather for the
correct approach to the problem:
- create two pipes
- fork
- dup2 stdout and stderr onto the write-ends of the pipe
- exec argv+1
- read from read-ends of the pipes and count++ on '\n'
Using popen(3) can't work, since you can't separately count stdout and
stderr from the child process.
Invoking 'wc -l' in one of the child processes doesn't get you the count
of stderr, so that fails, too.  (And is expensive, in comparison.)
-Jan
    
    
More information about the cs631apue
mailing list