Mail Archives: djgpp/1996/10/13/16:30:31
> from standard input or from a file.  Like the more command ( on unix ) or 
> grep or something.  I also want to use ifstreams to do the input.  
As a side note, more uses two input files, stdin and the controlling
terminal of the session.
>         Can I assume that standard input is always file descriptor 0, or 
Yes. (stdio makes the same assumption.) In Unix, if descriptor 0 is open
then whatever file it is, it is standard input. Descriptor 1 is always
stdout, descriptor 2 is always stderr.
The descriptors aren't sacred: you close them and open some other file
there if you want, but every shell guarentees 0, 1, and 2 are open, 0 is
readable, 1 and 2 are writable. It is possible that if your program is
execed from a non-shell, descriptor 0 could be closed or not readable, but
that would then be a violation of your program's calling conventions.
-- 
The winter ceased its weary grip    | smryan AT netcom DOT com  PO Box 1563
when soft and sudden sunbeams slip  |          Cupertino, California
and etch away the ice and gray,     | (xxx)xxx-xxxx            95015
with life to soul and song to lip.  |         I don't use no smileys
- Raw text -