www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/12/29/08:00:20

From: Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Detecting stdin not redirected
Date: Sun, 29 Dec 2002 11:29:24 +0000
Lines: 18
Message-ID: <3E0EDC94.421FD75E@phekda.freeserve.co.uk>
References: <3E0EA6CF DOT 51896D97 AT yahoo DOT com>
NNTP-Posting-Host: 62.136.12.54
Mime-Version: 1.0
X-Trace: newsg1.svr.pol.co.uk 1041165906 15886 62.136.12.54 (29 Dec 2002 12:45:06 GMT)
NNTP-Posting-Date: 29 Dec 2002 12:45:06 GMT
X-Complaints-To: abuse AT theplanet DOT net
X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586)
X-Accept-Language: de,fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hello.

CBFalconer wrote:
> With gcc and DJGPP, how can a running program detect that stdin
> has not been redirected from the keyboard?  How portable is such a
> method, i.e. will it hold up for Linux?  To allow for use of
> external terminals, I guess the thing wanted is to detect that
> stdin is actually a disk file (or a pipe) as opposed to a device.
[snip]

Take a look at isatty:

    info libc alpha isatty

Regards,

-- 
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]

- Raw text -


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