Read whole ASCII file into C++ std::string
There are a couple of possibilities. One I like uses a stringstream as a go-between: Now the contents of “file.txt” are available in a string as buffer.str(). Another possibility (though I certainly don’t like it as well) is much more like your original: Officially, this isn’t required to work under the C++98 or 03 standard (string … Read more