-
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) · 1.13 KB
/
main.cpp
File metadata and controls
52 lines (41 loc) · 1.13 KB
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
52
#include <iostream>
#include <fstream>
#include <string.h>
#include <vector>
#include <algorithm>
using namespace std;
void write_file(ofstream *file_ptr, vector<string>* str){
}
int main(int argc, char* argv[]){
ifstream myReadFile;
ofstream myWriteFile;
string buf;
vector<string> dest_buf;
int num_strings = 0;
dest_buf.reserve(100);
myWriteFile.open("ztype.out");
myReadFile.open(argv[1]);
if(myReadFile.is_open()){
while(1){
if(getline(myReadFile, buf,'\n')){
// Get rid of all the special characters
buf.erase(remove_if(buf.begin(), buf.end(),::ispunct), buf.end());
myWriteFile << buf<<endl;
/* if(num_strings++ <= 100){
dest_buf.push_back(buf);
}else{
write_file(&myWriteFile, &dest_buf);
num_strings = 0;
}
cout << buf<<endl;*/
}else{
break;
}
}
}else{
cerr<<"File not valid \n";
}
myWriteFile.close();
myReadFile.close();
return 0;
}