-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
69 lines (51 loc) · 1.39 KB
/
Main.cpp
File metadata and controls
69 lines (51 loc) · 1.39 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include <iostream>
#include <string>
#include <fstream>
#define INPUT_ERROR 1
#define OUTPUT_ERROR 2
#define UNKNOWN_ERROR 3
using namespace std;
class editor {
private:
string input_file, output_file; //useless variables
public:
string split(string str, char sep) {
string name;
string res;
const auto x = str.find_first_of(sep);
if (string::npos != x) {
name = str.substr(0, x);
res = str.substr(x + 1);
} else {
name = str;
}
return res;
}
};
int main(int argc, char *argv[]){
editor p;
system("dir /b > temp");
ifstream in("temp");
if(!in) {
return 1;
}
string str, res, command, command2;
const char *c, *c2;
while (std::getline(in, str)) {
if(isdigit(str[0])) {
if(str.find(" - ") != string::npos) {
res = p.split(str, '-');
res = p.split(res, ' ');
command = "copy \""+str+"\" \""+res+"\"";
c = command.c_str();
command2 = "del \""+str+"\"";
c2 = command2.c_str();
system(c);
system(c2);
}
}
}
in.close();
system("del temp");
return 0;
}