Hi there,
I need to read a file with unknown number of columns and lines. Basically, I have an ID per line (ID00005) and many columns containing 2 letters. The format is:
ID00005 RR WW SS QQ TT RR UU II
ID00008 WW SS QQ YY HH JJ KK LL
ID00011 WW SS QQ YY HH JJ KK LL
...
I don't known how to read line by line, getting column by column after ID (RR WW SS QQ TT ...) and do some calculations using the column information (RR WW). The calculation is count the number of occurrence of each two letters Example line 1 (RR = 2 times)
I only know how to get ID and number of columns that I can count
The idea is read the first line, do the calculation based on the elements of columns and after that, go to the next line
Can anyone help me?
Thanks a lot!
string ID = "";
if ( myfile.is_open() )
{
while(myfile >> lineString)
{
ID = lineString;
myfile >> lineString;
// ??????????????????????????
}
}
else
cout << "Unable to open file." << endl;