opening a file descriptor

Discussion in 'C' started by vin_pll, Nov 24, 2007.

  1. vin_pll

    vin_pll New Member

    Joined:
    Nov 24, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice