-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
52 lines (41 loc) · 908 Bytes
/
main.cpp
File metadata and controls
52 lines (41 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*
* File: main.cpp
* Author: homayoun
*
* Created on November 9, 2011, 9:53 AM
*/
#include <iostream>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
ifstream in_file;
ofstream out_file;
string Input;
if (argc != 3) {
cout << "Usage: " << argv[0] << " <Input file> <outfile>" << endl;
exit(1);
}
in_file.open(argv[1]);
if (in_file.fail()) {
cout << "Error openning the file " << argv[1] << " \n";
exit(1);
}
out_file.open(argv[2]);
if (out_file.fail()) {
cout << "Error openning the file " << argv[2] << " \n";
exit(1);
}
while (!in_file.eof()) {
getline(in_file, Input);
out_file << Input << endl;
}
in_file.close();
out_file.close();
return (EXIT_SUCCESS);
}