I'm using the following code to put the contents of a a file into a 2D array.
This is working fine for my purposes, but I can't figure out how to do any type of "substr" operations on the array. I want to extract the first 8 characters of each getTheLine[s] component and display it. As of now, I'm using something similar toCode:getline(readFile, line, '\n'); while (!readFile.eof()) { strcpy(getTheLine[s], line.c_str()); getline(readFile, line, '\n'); s++; }
which looks horrible. There has to be a better way to do it? Thanks in advance.Code:for... cout << getTheLines[i][0] << getTheLines[i][1] << getTheLines[i][2]



LinkBack URL
About LinkBacks



