Validity of an fd?

Henry Spencer henry at utzoo.uucp
Sun Apr 8 08:28:43 AEST 1990

In article <8764 at> wross at (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 at

More information about the Comp.lang.c mailing list