Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!security!genrad!decvax!harpo!seismo!hao!hplabs!sri-unix!phil.rice@rand-relay From: phil.rice%rand-relay@sri-unix.UUCP Newsgroups: net.unix-wizards Subject: Re: fdopen() problem in stdio Message-ID: <13400@sri-arpa.UUCP> Date: Sun, 6-Nov-83 16:11:03 EST Article-I.D.: sri-arpa.13400 Posted: Sun Nov 6 16:11:03 1983 Date-Received: Tue, 8-Nov-83 22:21:55 EST Lines: 23 From: William LeFebvre "The problem is that after 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." Rather than doing the fdopen on the original file descriptor (with fdopen(fd, ...)), you could do a fdopen(dup(fd), ...). Then you can call fclose() and not worry about the original file descriptor getting closed. Offhand, I think that this is the only way, short of mucking around in _iob[], that you can do what you want to do. The major drawback to this scheme, of course, is that you can run out of file descriptors (instead of FILE *'s) if you do this alot. William LeFebvre ARPANet: phil.rice@Rand-Relay CSNet: phil@rice USENet: ...!lbl-csam!rice!phil