Subject: fdopen()
To: None <tech-kern@netbsd.org>
From: Kamal Prasad <kamalpr@yahoo.com>
List: tech-kern
Date: 07/05/2002 07:36:58
Hello,
 I want to implement an fdopen() and use libc
functions over the returned FILE* . can someone give
me the semantics reqd for the same? I cannot use std
fdopen() because Im dealing with a pseudo file
descriptor (and the read().write() fns etc.. are
written by me).
my code looks something like this:-
FILE* __fdopen(int fd)
{
 FILE* fp = (FILE*) malloc(sizeof(FILE));
 fp->read = __read;
 fp->write = __write;
 fp->seek = __seek;
 /* what else do I need */

 /* end */
 return fp;
}


FILE* myfile = __fdopen(pseudo-fd);
while (!feof(fp))
fprintf(myfile, ...);
fgets(buff,fp);
--------------------------------
thanks
-kamal


__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com