fdopen() problem in stdio

greep%su-dsn at sri-unix.UUCP greep%su-dsn at sri-unix.UUCP
Mon Nov 7 05:40:00 AEST 1983


You can do a dup() on the file descriptor first, then the close() done
by fclose() won't really caused the file to be closed.  Of course you'll
have to keep track of the new file descriptor returned by dup().

However, (at least in 4.1bsd) _NFILE in stdio.h is set to 20, the same
value is the number of open files per process the kernel lets you have
(defined in NOFILE in /usr/sys/h/param.h), so if you're running out of
stdio buffers, you'll probably run out of file descriptors pretty soon.



More information about the Comp.unix.wizards mailing list