Website Summary Files Commits Branches @commit @diff @stats
path: root / src / Models / Table.cpp
diff options
context:
space:
mode:
Commit9d3cc59256daa844e3b3d65a9010738bc046b588 (patch)
Author
 Syndamia <kamen@syndamia.com>
2022-05-30 21:43:50 +0300
Committer
 Syndamia <kamen@syndamia.com>
2022-05-30 21:43:50 +0300
Files3daa6e7d1add661c938c821d37ab7a05e08fa4a0 /src/Models/Table.cpp
FMI-OOP-P2_Tables-9d3cc59256daa844e3b3d65a9010738bc046b588.tar
FMI-OOP-P2_Tables-9d3cc59256daa844e3b3d65a9010738bc046b588.tar.gz
FMI-OOP-P2_Tables-9d3cc59256daa844e3b3d65a9010738bc046b588.zip
Parent5b8613c8634e2ed9f02d36582ea5bb588955cd95 (diff)
Autocommit at 30.05.2022 @ 21:43
1 files changed, 3 insertions, 2 deletions
-rw-r--r--src/Models/Table.cpp5
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++;