about summary refs log tree commit diff stats
path: root/src/main.cpp
diff options
context:
space:
mode:
authorComradeCrow <comradecrow@vivaldi.net>2023-04-26 16:45:28 -0700
committerComradeCrow <comradecrow@vivaldi.net>2023-04-26 16:45:28 -0700
commit304f8dcd8d1e217dce56ccebb9be6f95d558ab31 (patch)
tree04a8888e503a1e7d0d072a915fe7842877ee8614 /src/main.cpp
parentcf0ab4d19100846a9850a3cc39110d8d8cfd1607 (diff)
downloadytcpp-304f8dcd8d1e217dce56ccebb9be6f95d558ab31.tar.gz
progress
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 059657c..69309c0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -7,6 +7,7 @@
 // #include <exception>
 // #include <vector>
 #include <fstream>
+#include <filesystem>
 
 #include "tui.hpp"
 #include "invapi.hpp"
@@ -17,21 +18,20 @@
 // namespace py = pybind11;
 using namespace std;
 using json = nlohmann::json;
+namespace fs = std::filesystem;
 
 void validateStructConversions() {
+    fs::path here("raycharles.json");
+    cout << fs::absolute(here) << endl;
 
-    std::ifstream inputFile{"./raycharles.json"};
-    auto size = inputFile.tellg();
-    cout << size << endl;
-    std::string str(size, '\0'); // construct string to stream size
-    inputFile.seekg(0);
-    if(inputFile.read(&str[0], size))
-        std::cout << str << '\n';
+    ifstream ifs;
+    ifs.open(fs::absolute(here).c_str(), ifstream::in);  
     
-    // json info = json::parse(inputFile);
-    // Video::video v = info["entries"].get<Video::video>();
-    // json j = v;
-    // cout << j << endl;
+    json info = json::parse(ifs);
+
+    Video::video v = info["entries"][0].get<Video::video>();
+    json j = v;
+    cout << j << endl;
 } 
 
 int main(int argc, char **argv) {