problem with stream buffer

Discussion in 'C++' started by vin_pll, Jun 14, 2008.

  1. vin_pll

    vin_pll New Member

    Nov 24, 2007
    Likes Received:
    Trophy Points:
    Hello experts,

    i have one query which i am not able to solve please suggest me my problem is i have to open a filedescriptor and have to store the contents in streambuffer,

    int main () {
     char ch;
     streambuf * pbuf;size_t size;
      ifstream istr(const char *)fd);
      pbuf = istr.rdbuf();
      while (pbuf->sgetc()!=EOF)
         ch = pbuf->sbumpc();
         cout << ch;
      return 0;
    but here the line
    ifstream istr(const char *)fd);
    is not properly interpreting thats why there is no out put

    if i simply give
    ifstream istr(fd);
    it gives me error as this method does not exist,
    please helop me what to do but i want the result in <b>streambuffer</b> because this is the input for some other module in my project pleasesuggest what are the different way i can get so the i get the contents in <b>streambuffer.</b>

    thanks in advance.

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