-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
67 lines (61 loc) · 1.37 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include <iostream>
#include <string>
#include "erase.h"
#include "copyfiles.h"
#include "devicelist.h"
#include "usage.h"
#include "fillzero.h"
#include "fillone.h"
#include "fillrandom.h"
using namespace std;
int main(int argc, char ** argv){
string inputFilePath, cmd, systemConnectedDrive;
int numberOfIteration;
system("cat banner");
memeraseUsage();
char input;
for (int i = 1; i < argc; ++i){
string str = *(argv + i);
if (str == "-f"){
inputFilePath = *((argv + i) + 1);
cmd = inputFilePath + " >> file-from-user";
system(cmd.c_str());
}
else if (str == "-i"){
numberOfIteration = stoi(*((argv + i) + 1));
}
else if(str == "-o"){
fillZero();
}
else if (str == "-l"){
fillOne();
}
else if (str == "-r"){
fillRandom();
}
else {
cout << "Oohh... Please enter a valid input." << endl;
memeraseUsage();
}
}
cout <<"Corrently inserted device : " << endl;
string * list;
list = systemConnectedDrives();
for (int i = 0; i < 4; i++){
cout << list[i] << endl;
}
cout << "Insert the memory device or confirm the drive[Y/n]:" << endl;
cin >> input;
if (input == 'y' or input == 'Y'){
for (int i = 0; i < numberOfIteration; i++){
/*sleep 2 sec*/
eraseDrive(systemConnectedDrive);
/*sleep 2 sec*/
copyFiles(inputFilePath);
}
}
else {
cout << "memErase terminated!..." << endl;
}
return 0;
}