-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
46 lines (36 loc) · 1.02 KB
/
main.cpp
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
#include <fstream>
#include <iostream>
#include <string>
int main(int argc, char* argv[]) {
if (argc <2)
return 1;
std::ifstream myfile;
myfile.open(argv[1]);
std::string line;
std::ofstream out_file;
out_file.open (std::string(argv[1])+".data", std::ofstream::out | std::ofstream::binary);
while(std::getline(myfile,line)) {
line.erase(0, 6);
unsigned long delka = line.length();
unsigned long i;
for (unsigned long j = 0, i = 0; i < line.length(); j++, i = i + 2) {
if (j % 2 == 0) {
i++;
}
if (i >= delka) {
break;
}
delka--;
}
line.erase(line.begin() + delka, line.end());
for (unsigned long i=0; i<line.length();i++){
if (!isalnum(line[i])) {
line.erase(line.begin() + i, line.begin() + i + 1);
i--;
}
}
out_file << line;
}
out_file.close();
return 0;
}