im reading in from a file that looks like this
The goal is to separate the original identifier (S, A, P, I, O, M), the descripter (inside the parenthesis) and the number, which is how many times it cycles. I need to use the cycle times with another function.
Based on their identifier I need to do something with them, but I can't get it to read in properly. here is my current code.
char ldelim('(');
char rdelim(')');
char delimeter('; '); //The space after the colon fixed a lot, but added some
//new errors.. plus i think thats bad coding
/*this just bypasses that first line without any data. Probably not a good way
to do it */
getline(metaFile, nothing);
while(!metaFile.eof())
{
getline(metaFile, metaCode, ldelim);
getline(metaFile, metaDesc, rdelim);
getline(metaFile, metaCycle, delimeter);
cycles = stoi(metaCycle);
codes.push_back(metaCode);
desc.push_back(metaDesc);
mcycles.push_back(cycles);
if (metaCode == S)
cout << "SSSSS\n";
if (metaCode == P)
cout << "PPPPP\n";
if (metaCode == A)
cout << "AAAAA\n";
if (metaCode == I)
cout << "IIIII\n";
if (metaCode == O)
cout << "OOOOOO\n";
if (metaCode == M)
cout << "MMMMMM\n";
else{
cout << metaCode << "\n";
}
Obviously I'm not going to use those if statements, but I wanted to test what the vector was taking in. Here is what I got back. The first output is with the space after the colon, the 2nd output is without the space after the colon. As you can see its ignoring some values. Is there a better way to do this?