I need to know the number of columns from a text file with floats.
I\'ve made like this to know the number of lines:
inFile.open(pathV);
// checks if f
You can do this very easily if these three assumptions are true:
dummyLine
is defined so that you have access to it outside the while
loop scopedummyLine
will contain after the while
loop)If all these are true, then right after the while
loop you'll just need to do this:
const int numCollums = std::count( dummyLine.begin(), dummyLine.end(), '\t' ) + std::count( dummyLine.begin(), dummyLine.end(), ' ' ) + 1;