I'm writing a program that takes a txt file like this:
foo.txt:
Aaaa/NGACG/NGAA//
Aaab/AGGGC//
Aaac/CTN/AGGC/NNA//
And in each line it stores the ID (Aaa..) into a vector (once for each value), and the values separated by / into strings.
So the first line would be:
foo.push_back("Aaaa");
string bar = NGACG;
foo.push_back("Aaaa");
string bar2 = NGAA;
The pseudocode is something like this:
while (not end of file)
{
while (not end of line)
{
while (next char isn't /)
{
temporary string x += char
}
foo.push_back(string) //ID
while (next char isn't /)
{
string bar += char //value
}
}
}
My pseudocode is obviously flawed, but that's the general idea of what I want to do. I've looked up guides on how to parse, but nothing really works for my purposes. How can I do this without being completely inefficient? I can't think of how to write this without using an arbitrary number of while loops