-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
45 lines (35 loc) · 1.13 KB
/
main.cpp
File metadata and controls
45 lines (35 loc) · 1.13 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
#include <iostream>
#include <string.h>
#include <cstdlib>
#include <filesystem>
#include "main-console.h"
using namespace std;
#ifdef _WIN32
#define CLEAR_COMMAND "cls"
#else
#define CLEAR_COMMAND "clear"
#endif
int main() {
srand(time(0));
system(CLEAR_COMMAND);
//clear all files under logs folder
// Clear or create csopesy-log.txt
std::ofstream logFile("csopesy-log.txt", std::ofstream::out | std::ofstream::trunc);
if (logFile.is_open()) {
logFile << "--- CSOPESY CPU Utilization Log ---\n\n";
logFile.close();
} else {
std::cerr << "Error: Could not create or clear csopesy-log.txt\n";
}
std::ofstream backing("csopesy-backing-store.txt", std::ofstream::out | std::ofstream::trunc);
if (backing.is_open()) {
backing << "--- CSOPESY BACKING STORE ---\n\n";
backing.close();
} else {
std::cerr << "Error: Could not create or clear csopesy-backing-store.txt\n";
}
std::unique_ptr<IConsole> mainConsole = std::make_unique<MainConsole>();
mainConsole->displayConsoleHeader();
mainConsole->handleCommand();
return 0;
}