-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimeout.cpp
More file actions
47 lines (41 loc) · 1.05 KB
/
timeout.cpp
File metadata and controls
47 lines (41 loc) · 1.05 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
#include <csignal>
#include <cstdlib>
#include <stdio.h>
#include <stdbool.h>
#include "timeout.h"
#include <bits/stdc++.h>
#include "csv-parser/include/csv.hpp"
using namespace csv;
int verifyTime(std::string appName){
CSVReader reader("times.csv");
CSVReader reader2("timeout.csv");
std::string sum, sum2;
//char command[100];
for (auto& row: reader) {
sum = row[appName].get<std::string>();
}
for (auto& row2: reader2) {
sum2 = row2[appName].get<std::string>();
}
char arr[appName.length() + 1];
// Specify the ranges
auto first = appName.begin();
auto last = appName.end();
// Convert the string to char array
copy(first, last, arr);
std::string command = "killall " + appName;;
if(sum == sum2){
return system(command.c_str());
} else {
printf("time not endend..\n");
return 0;
}
}
int main(int argc, char** argv){
if (argv[1]){
return verifyTime(argv[1]);
} else {
printf("Please put app name\n");
return 1;
}
}