diff options
| Commit | 9d3cc59256daa844e3b3d65a9010738bc046b588 (patch) | |
|---|---|---|
| Author | 2022-05-30 21:43:50 +0300 | |
| Committer | 2022-05-30 21:43:50 +0300 | |
| Files | 3daa6e7d1add661c938c821d37ab7a05e08fa4a0 /src | |
| FMI-OOP-P2_Tables-9d3cc59256daa844e3b3d65a9010738bc046b588.tar FMI-OOP-P2_Tables-9d3cc59256daa844e3b3d65a9010738bc046b588.tar.gz FMI-OOP-P2_Tables-9d3cc59256daa844e3b3d65a9010738bc046b588.zip | ||
| Parent | 5b8613c8634e2ed9f02d36582ea5bb588955cd95 (diff) | |
Autocommit at 30.05.2022 @ 21:43
2 files changed, 3 insertions, 5 deletions
| -rw-r--r-- | src/Models/Table.cpp | 5 | ||||
| -rw-r--r-- | src/test.table | 3 |
diff --git a/src/Models/Table.cpp b/src/Models/Table.cpp index 9ef5884..60da314 100644 --- a/src/Models/Table.cpp +++ b/src/Models/Table.cpp @@ -13,7 +13,7 @@ unsigned countOfCommas(std::ifstream& file) { unsigned currPos = file.tellg(); unsigned commaCount = 0; - while (file.peek() != '\n') { + while (file.peek() != '\n' && file.peek() != EOF) { if (file.get() == ',') commaCount++; } file.seekg(currPos, std::ios::beg); @@ -37,9 +37,10 @@ void Table::readFromFile(std::ifstream& inFile) { unsigned colInd = 0; cells.add(List<Cell*>(commaCount)); - while (inFile.peek() != EOF) { + while (!inFile.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++; diff --git a/src/test.table b/src/test.table index 147e7e9..9290552 100644 --- a/src/test.table +++ b/src/test.table @@ -1,5 +1,2 @@ 8.6,3,"String","= 3 * R0C1 + R0C0 ^ R0C1 * 27 / R0C1 - 2 * 2.5 * 2 * 2 + R0C2 ^ R0C2",, ,,,,, -,,,,, -,,,,, -,,,,, |
