diff options
2 files changed, 3 insertions, 3 deletions
| -rw-r--r-- | src/Models/Table.cpp | 5 | ||||
| -rw-r--r-- | src/UserInterface/UserInterface.cpp | 1 |
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<Cell*>()); - 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 <iostream> 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<List<Cell*>>(); 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()); |
