I'm having trouble reading in values from a file. I know how to get all of the values in the file, but I only need some of them.
This is my code (a snippet) so far.
ifstream myStream( file ); // file is the file name .
while (true)
{
std::getline( myStream, line '\n');
std::getline(myStream, line '\n');
std::istringstream myStream( line );
int i;
myStream >> i;
std::vector<int> myContainer;
myContainer.push_back( i );
}
The file has:
label1
1 2 3 4 5
label2
1 2 3 4 5
The code get all the values, but I just need the values under label1 for example. Does anyone know how to do this? Many thanks.