If anyone could give me a pointer here I would be grateful. I am making a public function that takes to container objects called bags and a file name in their arguments. I'm trying to create a loop that would extract the first line of doubles in a file and insert them into this bag/container object "firstBag" and then go to the second line and insert them into the "secondBag" object. There is a function that the bag object uses to insert numbers called insert(). Now I have figured out how to break the files lines up using the getline() function. But within that line i need to loop through each string line and pick up the double/floating point values.
essentially here is the idea
// getline( fileobject, stringline )
// loop through string and insert values into firstBag
// do it again for bag2
here is what i have started
void readFiles( correaj::bag& firstBag, correaj::bag& secondBag, char fileName[] )
{
std::ifstream inData;
std::string fileLine;
inData.open( fileName ); // opens the user inserted file from main
getline ( inData, fileLine );
// start here
inData.close();
}
Thanks all