-
Notifications
You must be signed in to change notification settings - Fork 1
/
tricat.cpp
62 lines (54 loc) · 1.11 KB
/
tricat.cpp
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
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
Jordan Dehmel
github.com/jorbDehmel
2023 - present
MIT licence via mit-license.org held by author
*/
#include <iostream>
#include <fstream>
#include <string>
#include "src/tags.hpp"
#include "src/trit.hpp"
#include "src/tryteMath.hpp"
using namespace std;
int main(const int argc, const char *argv[])
{
if (argc != 2)
{
cout << tags::red_bold
<< "Invalid syntax.\n"
<< tags::reset;
return 1;
}
ifstream in(argv[1]);
if (!in.is_open())
{
cout << tags::red_bold
<< "Could not open file.\n"
<< tags::reset;
return 2;
}
string text, line;
while (getline(in, line))
{
text += line;
}
in.close();
auto out = rawParseTrytes(text);
for (int i = 0; i < (int)out.size(); i++)
{
if (i % 3 == 0)
{
if (i != 0)
{
cout << '\n';
}
cout << i << "\t|\t";
}
cout << out[i] << "\t\t";
}
cout << '\n'
<< "Size: " << out.size() << " trytes\n";
return 0;
}