Mail Archives: djgpp/2000/07/06/03:23:44
On Wed, 5 Jul 2000, Steamer wrote:
> > > There isn't even a standard way to check that stdin isn't coming
> > > from a file.
> >
> > What's wrong with fstat(fileno(stdin), &s) ?
>
> Neither fstat() nor fileno() is defined in ANSI/ISO C, which is what
> I meant by "standard".
IMHO, it's not useful to rely on ANSI Standard alone for programs that
deal with files. ANSI doesn't even say what ``a file'' is, and doesn't
define that a file resides on a disk.
Posix is the way to go if you need to work with files. Both `fstat'
and `fileno' are very portable, even to non-Posix platforms such as
DOS and Windows compilers.
- Raw text -