Date: Fri, 9 Jul 1999 00:45:55 +0200 (MET DST) From: Gisle Vanem To: djgpp AT delorie DOT com Subject: fdopen() and FSEXT'ensions Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com 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? My code looks something like this: s = socket (AF_INET, SOCK_DGRAM, 0) in socket(): __FSEXT_set_function (s, _fsext_demux); fil = fdopen (s,"r+"); bind(), connect() etc. if (fprintf(fil, "HELO %s\r\n", _hostname) < 0) { perror ("fprintf"); exit (-1); } The program always gives me fil=NULL and errno=EBADF. What special tricks do I need to use a socket with stream functions? Gisle V.