[cs631apue] -C option for midterm project

Jan Schaumann jschauma at stevens.edu
Sat Oct 3 14:30:19 EDT 2015


Julian Sexton <jsexton at stevens.edu> wrote:
> I was just wondering what it meant, for the -C option on the homework for
> output to not be "to a terminal". If this tool just writes to stdout how
> would it differentiate between a terminal and something else?

Stdout is just a file descriptor.  It can be connected to anything:

$ program >file               # stdout connects to a file
$ mkfifo fifo; program >fifo  # stdout connects to a fifo
$ program | program2          # stdout connects to a pipe
$ program                     # stdout connects to a terminal

See isatty(3) to find out whether or not a file descriptor is connected
to a terminal.

-Jan


More information about the cs631apue mailing list