Inspired by Chromium’s sha1 class, I am thinking to store incrementally downloaded data using std::string
// pseudo-code
char buff[BUFF_SIZE];
std::string data;
do {
size = ReadInternetFileTo(buff,BUFF_SIZE);
data.append(buff,size);
} while (not_finished);
Any foreseeable problems with this method or better way to do it?
Should be OK, but you may want to consider rope instead of string. It is more efficient to append to a rope, as it won’t promise to keep all bytes consecutive, which will require a reallocation.