Newsgroups: comp.lang.c
Path: utzoo!henry
From: henry@utzoo.uucp (Henry Spencer)
Subject: Re: Validity of an fd?
Message-ID: <1990Apr7.222843.14249@utzoo.uucp>
Organization: U of Toronto Zoology
References: <8764@pt.cs.cmu.edu>
Date: Sat, 7 Apr 90 22:28:43 GMT

In article <8764@pt.cs.cmu.edu> wross@ius3.ius.cs.cmu.edu (William Ross) writes:
>    What's the quickest/easiest way to check if
>    a file descriptor points to a valid, open
>    file?

Remember whether you got it from a function which is guaranteed to return
same.  There isn't any terribly good general way of checking this.  (If
we are talking about Unix file descriptors rather than ANSI C "FILE *"s,
you might try fstat(), but that's not very portable.)
-- 
Apollo @ 8yrs: one small step.|     Henry Spencer at U of Toronto Zoology
Space station @ 8yrs:        .| uunet!attcan!utzoo!henry henry@zoo.toronto.edu
