Is there anyway to read a known number of bytes, directly into an std::string, without creating a temporary buffer to do so?
eg currently I can do it by
An easy way would be:
std::istream& data const size_t dataSize(static_cast(data.rdbuf()->in_avail())); std::string content; content.reserve( dataSize); data.read(&content[0], dataSize);