Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   opening a file descriptor (http://www.go4expert.com/forums/file-descriptor-t7505/)

vin_pll 24Nov2007 16:44

opening a file descriptor
 
Hello all,
iam working on some project in which i need to open a file descriptor and send it to the streambuf,
which iam doing like

Code:
Code:

ifstream f(fd);
streambuf * buf2=f.rdbuf();

but main problem is that they are casting to

Code:
Code:

ifstream f((const char *)fd)
streambuf * buf2=f.rdbuf();

because of which the file is not getting opened ,if i remove that leads to error there are using some conventions

there are many ways are also there like

Code:
Code:

File *ptr=fdopen(fd);
which is successfull and returning the value.
but i want the the output to be given in streambuf which other parts of my project is using,
can u tell me is there any way to convert the file pointer to the streambuf or is there anyway of reading the file so that the output will result in the streambuf
with this convention

Code:
Code:

((const char *)fd)
please help me.


All times are GMT +5.5. The time now is 12:29.