reading delmitited file to char array help
Oct 11, 2013 at 10:20pm UTC
Currently I have
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
ifstream inFile;
inFile.open("tasks.txt" , ifstream::in);
if (!inFile) {
cerr << "Error: file could not be opened" << endl;
return ;
}
string line;
if (inFile.is_open())
{
while ( getline (inFile,line) )
{
cout << endl;
cout << line << endl;
}
inFile.close();
}
to print from file to common out.
1 2 3 4 5 6 7
foo;bar;fooobarbar
foo;bar;fooobarbar
foo;bar;fooobarbar
foo;bar;fooobarbar
foo;bar;fooobarbar
foo;bar;fooobarbar
but how would i iterate through this
while adding each piece of data to a char array instead of using a string while obviously consuming the ";" to the null
an array like..
array[row1/index][col1][co2][col3]
Last edited on Oct 11, 2013 at 10:22pm UTC
Topic archived. No new replies allowed.