Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main(int argc, char **argv) {
- system("cls");
- if(argc >= 3){
- const char *output_file = argv[argc - 1];
- ofstream o_fp;
- ifstream i_fp;
- int size;
- int total_size = 0;
- o_fp.open(output_file, ios::binary);
- for(int i = 1; i < argc - 1; i++){
- i_fp.open(argv[i], ios::binary);
- i_fp.seekg(0, ios::end);
- size = i_fp.tellg();
- i_fp.seekg(0, ios::beg);
- total_size += size;
- for(int j = 1; j <= size; j++){
- o_fp.put(i_fp.get());
- }
- i_fp.close();
- }
- cout << "Total Bytes copied = " << total_size << endl;
- cout << "Output file: " << output_file << " created successfuly!" << endl;
- o_fp.close();
- return 0;
- }
- else {
- cout << "In-sufficient number of arguments" << endl;
- cout << "USAGE: File3.exe in_file1 [in_file2 ... ] out_file" << endl;
- return 1;
- }
- }
Add Comment
Please, Sign In to add comment