From 89547bdeabefaa2c8055cc74fd3eac81b5e201be Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 30 May 2022 20:53:33 +0300 Subject: Autocommit at 30.05.2022 @ 20:53 --- src/Models/Table.cpp | 5 ++--- src/UserInterface/UserInterface.cpp | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp index 6ba20a4..0542991 100644 --- a/src/Models/Table.cpp +++ b/src/Models/Table.cpp @@ -32,7 +32,7 @@ void Table::readFromFile(std::ifstream& inFile) { unsigned commaCount = countOfCommas(inFile); unsigned colInd = 0; cells.add(List()); - while (!inFile.eof()) { + while (inFile.peek() != EOF) { while (inFile.peek() == ' ') inFile.get(); // Entering a new cell on the current row @@ -103,8 +103,7 @@ void Table::readFromFile(std::ifstream& inFile) { #include Table::Table(const char* filePath) { std::ifstream inFile(filePath); - std::cout << filePath << std::endl; - if (inFile.is_open()) + if (!inFile.is_open()) throw std::logic_error("Could not open file!"); cells = List>(); readFromFile(inFile); diff --git a/src/UserInterface/UserInterface.cpp b/src/UserInterface/UserInterface.cpp index 6352381..315b7e4 100644 --- a/src/UserInterface/UserInterface.cpp +++ b/src/UserInterface/UserInterface.cpp @@ -21,6 +21,7 @@ void UserInterface::com_open(const char* params) { table = new Table(params); fileName = params; saved = true; + printLine("Successfully opened file!"); } catch (std::logic_error err) { printLine(err.what()); -- cgit v1.3.1-26-gb76a