From d15b8a57e497513b1377d98be3d50cd82132e7de Mon Sep 17 00:00:00 2001 From: Patrick Lipka Date: Thu, 9 Dec 2021 11:43:14 +0100 Subject: [PATCH] Binary I/O fixed --- src/project.cpp | 35 +++++++++++++++++++---------------- src/tt.cpp | 11 +++++++++-- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/project.cpp b/src/project.cpp index 03f3f73..8845e82 100644 --- a/src/project.cpp +++ b/src/project.cpp @@ -35,12 +35,11 @@ void ProjectList::remove_project(int id){ } void ProjectList::save(std::string file_name){ - std::ofstream of(file_name, std::ios::out | std::ios::binary); + std::ofstream of(file_name, std::ios::binary); if (!of){ std::cout << "Could not open file " << file_name << " for writing!" << std::endl; exit(1); } - std::cout << num_projects << " " << num_projects << std::endl; of.write((char*) &num_projects, sizeof(int)); of.write((char*) &active_project, sizeof(int)); for (int i=0; i