bool CopyFileContents(std::string source, std::string target) { FILE *sourcefile = fopen(source.c_str(), "rb"); if(sourcefile == NULL){ errorstream< 0){ fwrite(readbuffer, 1, readbytes, targetfile); } if(readbytes != sizeof(readbuffer)){ // EOF or error on read (error case was handled above) // flush destination file to catch write errors fflush(targetfile); done = true; } if(ferror(targetfile)){ errorstream<