🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #32704

Re: File handle info

#32704
From: Piet van Oostrum
Date: Mon, 30 May 1988 08:56
18 lines
1243 bytes
I got a few mail replies on my question regarding where a file resides.
Some experimenting and combining the answers gave me a simple way to find
out if a file is on disk or a `terminal':

what I think is the easiest way to do it: if you seek to an illegal
position (like -1), you get an error (-64) if the file is on disk,
otherwise you get 0. If the file is on disk, its position is not changed,
so the operation is effectively always a no-op. So I use:

isatty (fd)
int fd;
{ return (Fseek (-1L, fd, 0) == 0); }

Please could any of the TOS developers comment on this?
-- 
Piet van Oostrum, Dept of Computer Science, University of Utrecht
Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands
Telephone: +31-30-531806              UUCP: ...!mcvax!ruuinf!piet
Technical Details
Message-ID: <465@ruuinf.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!ruuinf!piet
References: <447@ruuinf.UUCP> <324@bdt.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!mcvax!ruuinf!piet
From: piet@ruuinf.UUCP (Piet van Oostrum)
Newsgroups: comp.sys.atari.st
Subject: Re: File handle info
Message-ID: <465@ruuinf.UUCP>
Date: 30 May 88 08:56:49 GMT
References: <447@ruuinf.UUCP> <324@bdt.UUCP>
Organization: Univ of Utrecht, Dept of CS
Lines: 18
In-reply-to: david@bdt.UUCP's message of 26 May 88 17:35:01 GMT
Posting-Front-End: GNU Emacs 18.47.9 of Mon Mar 21 1988 on ruuinf (hcx/ux)