// バイナリ入力ファイルを一括読込 #include #include using namespace std; int main(int argc, char **argv){ ifstream ifs(argv[1]); ofstream ofs(argv[2]); // fstream::pos_type size; long size; ifs.seekg(0, ios_base::end); size = ifs.tellg(); ifs.seekg(0, ios_base::beg); cout << size << endl; char *buf = (char *)calloc(1, size); ifs.read(buf, size); ofs.write(buf, size); }