fdopen() problem in stdio

gwyn%brl-vld at sri-unix.UUCP gwyn%brl-vld at sri-unix.UUCP
Mon Nov 7 05:39:41 AEST 1983


From:      Doug Gwyn (VLD/VMB) <gwyn at brl-vld>

There is no direct way to free a FILE pointer without closing the file
descriptor.  However, if you dup() (or fcntl()) the descriptor first,
then the "close" will amount to a no-op insofar as its effects on the
inode attached to the file descriptor are concerned.  You can fclose()
the stream, dup() the duplicate fd back to its original value, then
close out the duplicate file descriptor and proceed to fdopen() as
before.



More information about the Comp.unix.wizards mailing list