-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
57 lines (42 loc) · 1.08 KB
/
Copy pathmain.cpp
File metadata and controls
57 lines (42 loc) · 1.08 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
#include <iostream>
#include <algorithm>
#include <thread>
#include "sequence/Sequence.h"
#include "parallel/Parallel.h"
#include "readers/DirReader.h"
#include <dirent.h>
using namespace std;
void dirVerification(string direct) {
DIR *dir;
if ((dir = opendir(direct.c_str())) != NULL) {
// Sleep(3000);
// printf("\nPath exists \n");
closedir(dir);
} else {
printf("\nEnter a valid path\n");
}
}
int main() {
Sequence sequence;
Parallel parallel;
DirReader dirReader;
// Read file path from system input
string path;
cout << "Enter Path:";
cin >> path;
cout << path;
printf("%s", "\n");
thread thread1(dirVerification, path);
string word;
cout << "Enter the Search String: ";
cin >> word;
transform(word.begin(), word.end(), word.begin(), (int (*)(int)) tolower);
thread1.join();
vector<string> st;
st = dirReader.dirReader(path);
// file reader in serial
sequence.runSequence(st, word);
// file reader in parallel
parallel.runParallel();
return 0;
}