www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/06/03:23:44

Date: Thu, 6 Jul 2000 10:21:39 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: djgpp AT delorie DOT com
Subject: Re: Newbie question about strings in C ..
In-Reply-To: <3963875c.42907716@news.freeserve.net>
Message-ID: <Pine.SUN.3.91.1000706102107.23332H-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019