fdopen() problem in stdio

hartwell%shasta at sri-unix.UUCP hartwell%shasta at sri-unix.UUCP
Sun Nov 6 19:42:00 AEST 1983


From:  Steve Hartwell <hartwell at shasta>

I have a daemon that calls a routine (repeatedly), passing a file descriptor
open on a file.  The routine does an lseek(fd, 0L, 0) and then calls
fdopen() on it, because it would like to use stdio to read the file via getc().

The problem is that after <N> calls to the routine, fdopen() returns NULL
because it runs out of FILE pointers (there is a static array of them in
stdio).  I don't want to use fclose(), that would close the file descriptor.

Anyone know a way to release a FILE pointer without closing the file itself?
Poking into the structure is not a solution I would like to consider.

This is for a 4.1BSD system.

Thanks,
    Steve Hartwell, Stanford



More information about the Comp.unix.wizards mailing list