For a program i'm writing I need to read a .txt file into a 2-d array. The txt file contains spaces that need to also be read into the array, so I was told I need to use getline, but after searching google and this site i'm not sure exactly how to use it. The 1st and last rows of the array also need to be blank, which is why i've started the for loops at 1. Any help would be much appreciated!
void readfile (string filename, char ba[][MAXCOL])
{
int inputline = 80;
ifstream myfile;
myfile.open("blob.txt");
for (int row=1; row<(MAXROW - 1); row++)
{
//getline
for (int col=1; col<(MAXCOL - 1); col++)
{
//getline?
}
}
myfile.close();
}