Date: Thu, 6 Jul 2000 10:21:39 +0300 (IDT) From: Eli Zaretskii 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: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 Precedence: bulk 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.