PREV INDEX NEXT

Author: Stan Eisenstat
Subject: Re: [Cs323] Pipe
Date: Saturday, 14 Nov 2020, 08:09:25


    > Message Posted By: Unknown
    >
    > Also, in the ls | wc -l example from class, why does ls have to write to 1
    > and wc read from 0. Can they not just read from fd[0] and fd[1].

No.  As we discussed during our tour of system-level
I/O, the convention is that stdin/stdout/stderr is file
descriptor 0/1/2.  ls and wc obey this convention.
=====

    > As a followup to this, does the pipe() command which takes in some int
    > fd[2] assign values to fd at the system level and keep track of it also?

Yes.

--Stan-
PREV INDEX NEXT