Hey guys,
i need some help with file pattern. I'm in a project that i read a file and the program makes a matrix.
the file pattern is
1;4;4
2;6;6
3;2;2
4;20;20;
where the first number before ';' is the code of the matrix, the second one is the row and the last one is the column.
i have no idea how i can put the code, row and column in an int variables
this is my function so far:
void Matrix::getLine()
{
string line;
stringstream cod, row, col;
int i_cod, i_row, i_col;
while(File->getFile().good())
{
getline(File->getFile(), line);
{
for(string::iterator it = line.begin();
it != line.end();
++it);
/*i'm thinking to use some algorithm here
to put the firt number before ';' in the cod
stream, the number between the ';' in the row
stream, and the last number after the ';' in the
col stream.And after that convert the streams to
an int variables*/
}
}
}
what i can do here??
I don't have to use iterator, i just thought to solve that splitting the file in characters.
Is there an easier way to do this?
I appreciate any help.
Thank you very much