Handling files wip

This commit is contained in:
Hazem Krimi
2024-03-21 22:56:04 +01:00
parent e3d5fa816f
commit 852904c40d
2 changed files with 36 additions and 2 deletions
+9 -2
View File
@@ -1,8 +1,15 @@
#include <iostream> #include <iostream>
#include <parser.h>
using namespace std; using namespace std;
int main() { int main(int argc, char *argv[])
cout << "VM Translator"; {
string path = argv[1];
Parser parser(path);
parser.printFile();
return 0; return 0;
} }
+27
View File
@@ -0,0 +1,27 @@
#include <string>
#include <iostream>
#include <fstream>
using namespace std;
class Parser
{
private:
ifstream file;
public:
Parser(string path)
{
file = ifstream(path);
}
void printFile()
{
string text;
while (getline(file, text))
{
cout << text;
}
}
};