From 0157e5f0ba9b3c62f060322abb34b319104255ad Mon Sep 17 00:00:00 2001 From: Syndamia Date: Mon, 30 May 2022 21:48:52 +0300 Subject: Autocommit at 30.05.2022 @ 21:48 --- src/Models/Table.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/Models/Table.cpp') diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp index 60da314..54c34bd 100644 --- a/src/Models/Table.cpp +++ b/src/Models/Table.cpp @@ -37,10 +37,9 @@ void Table::readFromFile(std::ifstream& inFile) { unsigned colInd = 0; cells.add(List(commaCount)); - while (!inFile.eof()) { + while (inFile.peek() != EOF) { while (inFile.peek() == ' ') inFile.get(); - std::cout << (char)inFile.peek() << std::endl; // Entering a new cell on the current row if (inFile.peek() == ',') { colInd++; @@ -91,11 +90,14 @@ void Table::readFromFile(std::ifstream& inFile) { String res; inFile.get(); while (inFile.peek() != '"') { + if (inFile.peek() == '\n') + throw std::logic_error(fileLocationExceptionMsg("Error: Could not find a matching end quote for string at row ", cells.get_count(), inFile.tellg() % commaCount + 1)); if (inFile.peek() == '\\') { inFile.get(); } res += inFile.get(); } + inFile.get(); if (*res.get_cstr() == '=') cells[cells.get_count() - 1][colInd++] = new CellFormula(res.get_cstr(), &cells); -- cgit v1.3.1-23-gd82d