#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
using std::ifstream;
using std::ofstream;
using std::string;
using std::cout;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char** argv) {
string ifname(argv[1]);
string ofname(argv[2]);
string str_size(argv[3]); // M bytes
int M_Bytes = std::stoi(str_size);
ifstream fin(ifname.c_str(),std::ios::binary) ;
int read_size = M_Bytes * 1024 * 1024;
char * buf = new char[read_size];
fin.read(buf,read_size);
fin.close();
ofstream fout(ofname.c_str(),std::ios::binary);
fout.write(buf,read_size);
fout.close();
cout << ifname << " , " << ofname << std::endl;
delete buf;
return 0;
}