I'm using the following code to put the contents of a a file into a 2D array.
Code:
getline(readFile, line, '\n');
while (!readFile.eof())
{
strcpy(getTheLine[s], line.c_str());
getline(readFile, line, '\n');
s++;
}
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 to
Code:
for...
cout << getTheLines[i][0] << getTheLines[i][1] << getTheLines[i][2]
which looks horrible. There has to be a better way to do it? Thanks in advance.