Date: Thu, 8 Jul 1999 21:10:18 -0400 (EDT) Message-Id: <199907090110.VAA25062@indy.delorie.com> From: DJ Delorie To: djgpp AT delorie DOT com In-reply-to: (message from Gisle Vanem on Fri, 9 Jul 1999 00:45:55 +0200 (MET DST)) Subject: Re: fdopen() and FSEXT'ensions Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > I've made an FSEXT'ension handler for network socket I/O. > Now I which to tie a socket to a 'FILE*' in order to use fgets(), > fprintf() etc. with the sockets. But looking at fdopen() or setmode(), > FSEXT'ension handlers aren't called. I would think that my handler > would get an '__FSEXT_open' command, but it never does. Is this > intentional or an oversight? That's just the way fdopen() works. It expects you to pass it an *already* opened file descriptor. In your case, the socket() call needs to not only set the fsext function, but open the fd as well (with __FSEXT_alloc_fd) (in fact, the docs for __FSEXT_alloc_fd have an example of implementing socket()!) http://www.delorie.com/djgpp/doc/libc-2.02/libc_315.html