diff options
Autocommit at 30.05.2022 @ 21:38
1 files changed, 3 insertions, 4 deletions
| -rw-r--r-- | src/Models/Table.cpp | 7 |
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp index 861e2f0..9ef5884 100644 --- a/src/Models/Table.cpp +++ b/src/Models/Table.cpp @@ -61,7 +61,7 @@ void Table::readFromFile(std::ifstream& inFile) { if (inFile.peek() == '-') whole *= -1; } - if (isDigit(inFile.peek())) + if (!isDigit(inFile.peek())) throw std::logic_error(fileLocationExceptionMsg("Error: Expected digit but got something else at row ", cells.get_count(), inFile.tellg() % commaCount + 1)); // Parsing digits of whole number/whole part of floating point number @@ -69,10 +69,10 @@ void Table::readFromFile(std::ifstream& inFile) { (whole *= 10) += inFile.get() - '0'; } // Parsing digits of potential floating point number - if (inFile.peek() != '.') { + if (inFile.peek() == '.') { inFile.get(); while (isDigit(inFile.peek())) { - inFile.get(); + (whole *= 10) += inFile.get() - '0'; exponent *= 10; } } @@ -110,7 +110,6 @@ Table::Table(const char* filePath) { std::ifstream inFile(filePath); if (!inFile.is_open()) throw std::logic_error("Could not open file!"); - std::cout << inFile.peek() << std::endl; cells = List<List<Cell*>>(); readFromFile(inFile); inFile.close(); |
