problem with steam buffer

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,

i,e

Code:

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;
  }

  istr.close();

  return 0;
}

but here the line

Code:

ifstream istr(const char *)fd);

is not properly interpreting thats why there is no out put

if i simply give

Code:

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 streambuffer 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 streambuffer
thanks in advance

ifstream istr(const char *)fd);

Surely this shouldn't even compile?
You have unbalanced parentheses and fd has not been declared.
A std::ifstream can be constructed by giving it the name of the file from which to read as a const char*, e.g.

ifstream istr("filename");