Skip to content

Instantly share code, notes, and snippets.

@BitPuffin
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BitPuffin/8429c982b58656e2b6c3 to your computer and use it in GitHub Desktop.
Save BitPuffin/8429c982b58656e2b6c3 to your computer and use it in GitHub Desktop.
void DownloadOperation::step() {
#define BUFFSIZE 200
char buf[BUFFSIZE];
std::streamsize readamount = this->httpstream.rdbuf()->sgetn(buf, BUFFSIZE);
if(readamount != 0)) {
this->outfile.write(buf, readamount);
}
if(this->httpstream.eof()) {
status_mutex.lock();
this->completed = true;
status_mutex.unlock();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment