-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
49 lines (43 loc) · 929 Bytes
/
main.cpp
File metadata and controls
49 lines (43 loc) · 929 Bytes
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
#include <iostream>
#include <cstring>
#include <fstream>
#include <string>
#include <vector>
#include <stdexcept>
#include <fstream>
#include "Command.hpp"
int main()
{
//std::cout << "hello world" << std::endl;
std::string filename;
std::ifstream file;
std::cout << "Enter a filename: ";
std::cin >> filename;
if (filename == "NO")
{
while (true)
{
std::string command;
std::cout << "Enter a command: ";
getline(std::cin, command);
Command::readCommand(command);
}
}
else
{
file.open(filename);
if (file.fail())
{
std::cout << "The opening of the file failed!" << std::endl;
return 1;
}
std::vector<std::string> contents;
std::string line;
while (!file.eof())
{
getline(file, line);
contents.push_back(line);
}
file.close();
}
}