diff --git a/concoredocker.hpp b/concoredocker.hpp index cbce7184..b978f32b 100644 --- a/concoredocker.hpp +++ b/concoredocker.hpp @@ -81,7 +81,7 @@ class Concore { std::vector read(int port, const std::string& name, const std::string& initstr) { std::this_thread::sleep_for(std::chrono::seconds(delay)); - std::string file_path = inpath + std::to_string(port) + "/" + name; + std::string file_path = inpath + "/" + std::to_string(port) + "/" + name; std::ifstream infile(file_path); std::string ins; @@ -94,6 +94,7 @@ class Concore { int attempts = 0, max_retries = 5; while (ins.empty() && attempts < max_retries) { std::this_thread::sleep_for(std::chrono::seconds(delay)); + infile.close(); infile.open(file_path); if (infile) std::getline(infile, ins); attempts++; @@ -110,7 +111,7 @@ class Concore { } void write(int port, const std::string& name, const std::vector& val, int delta = 0) { - std::string file_path = outpath + std::to_string(port) + "/" + name; + std::string file_path = outpath + "/" + std::to_string(port) + "/" + name; std::ofstream outfile(file_path); if (!outfile) { std::cerr << "Error writing to " << file_path << "\n";