Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I convert istream * to string or just print it?

Tags:

The below function part of connector/C++, it returns a istream*. if i just try and print it, it shows hex or a memory location because its a * type.

istream *stream = res->getBlob(1);

I tried to read & print it with this:

    string s; 
    while (getline(*stream, s))
    cout << s << endl; 

But this crashes with access violation though. any other way i can print it or convert to string?

the value of stream before the getline:

  • stream 0x005f3e88 {_Chcount=26806164129143632 } std::basic_istream > *

so it seems that its valid to me. I think it would be null or 0 if it failed