mirror of
https://github.com/hazemKrimi/jack-vm-translator.git
synced 2026-05-01 18:00:27 +00:00
Handling files wip
This commit is contained in:
+9
-2
@@ -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;
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user