It's dirty hack :)
You can save read data length returning by function read(); std::string has ctor (const char* s, size_t n)