stdio.h problem on 4.0 (was News 2.11.19...)

Marcus J. Ranum mjr at hussar.dco.dec.com
Sun Sep 16 06:17:45 AEST 1990


In article <1990Sep13.084901 at epb2.lbl.gov> envbvs at epb2.lbl.gov (Brian V. Smith) writes:

>The answer is to change the "fileno(fp) = -1;" to "fp->_file = -1;"
>and "fileno(fp) = fno;" to "fp->_file = fno;"

	What I don't understand about all this (and I won't, unless I
look at the code) is why they are setting the file descriptor to -1
anyhow. That seems kind of dubious to me.

	stdio is well behaved and works portably unless you start to
grub around in its private data. fclose() is a better way of disabling
a FILE * than setting its file descriptor to -1, and fdopen() is a better
way of wrapping a FILE * around an existing file descriptor.

mjr.
-- 
Any viewpoints expressed in this posting are not necessarily shared by
Digital Equipment, Inc., the poster's supervisor, or the poster's cats.
-- 

Eagles may soar, free and proud, but weasles never get sucked into jet engines.



More information about the Comp.unix.ultrix mailing list