fstream ifstream ofstream分块读写文件
#include <fstream> #include <algorithm> #include <iostream> using namespace std; int _tmain(int argc, _TCHAR* argv[]) { const int BUFFER_SIZE = 1024 * 10; std::ifstream ifs("e://setup_10.2.0.2001s.exe", ios::binary); std::ofstream ofs("e://setup_10.2.0.2001s2.exe", ios::binary); if (ifs) { ifs.seekg(0, ifs.end); int length = (int)ifs.tellg(); ifs.seekg(0, ifs.beg); std::string buffer(BUFFER_SIZE, '