Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!sdd.hp.com!decwrl!bacchus.pa.dec.com!decuac!hussar.dco.dec.com!mjr From: mjr@hussar.dco.dec.com (Marcus J. Ranum) Newsgroups: comp.unix.ultrix Subject: Re: stdio.h problem on 4.0 (was News 2.11.19...) Message-ID: <1990Sep15.201745.3550@decuac.dec.com> Date: 15 Sep 90 20:17:45 GMT References: <421@ucunix.SAN.UC.EDU> <21955@grebyn.com> <1990Sep13.084901@epb2.lbl.gov> Sender: news@decuac.dec.com (Network News) Reply-To: mjr@hussar.dco.dec.com.UUCP (Marcus J. Ranum) Organization: Digital Equipment Corp., Ultrix Resource Center Lines: 21 In article <1990Sep13.084901@epb2.lbl.gov> envbvs@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.