Is it possible to get a program to read certain lines (or any lines) of a text file and store it in a variable? If so, how is this done? I'd post some code, but I can't think of anything to put in it other than what I need to know...
Thanks
-Chris
Is it possible to get a program to read certain lines (or any lines) of a text file and store it in a variable? If so, how is this done? I'd post some code, but I can't think of anything to put in it other than what I need to know...
Thanks
-Chris
hrmm from what i understand you want to take a text file and store each line as a string..
so you would probably have to use 2 dimensional arrays. for ex:
int col=0;
int row=0;
char line[200][80];
this would hold 80 chars per line for 200 lines.
then you would do something like this:
input.get(line[row][col]);
while(input)
{
if(line[row][col] == '\n')
{
row++;//goto next row
col=0;//start at 0 col
}
col++;//increment col
input.get(line[row][col]);//get another char
}
hope dat helps... prlly a better way than that.