Yes, getline is correct. and use string . It hasfind and substring functions that will help split the string into values.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
Use the string as an array. Let's say you just read the string and you're looking for the first 'w':
searchchr = 'w';
i = 0;
while (line[i] != searchchr)
{
i++;
}
Now you can move everything up to the 'w' into another variable with.substr()
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
>>is there a way to make it read the values based on whitespace or something?
There are all sorts of search/reading/parsing routines that can be used based on each individual search criteria. Let's say that each line has a minimimum of 6 substrings all separated from one another by spaces. Each substring will have one or more characters, the only restriction to which is the char in the 5th and 6th substring have to represent digits in HEX. You always want the 5th and 6th substring to work with. To extract them you could call >> 4 times and ignore the input. Then call >> twice more to save desired values in desired variables. Then call getline() with a newline delimiter to clear the rest of the line and go to the next.
If you prefer to read in the entire line from the file and parse it from an istringstream object after it's been read in instead of parsing directly from the file using the same routine, so be it.
Lerner
Nearly a Posting Maven
2,382 posts since Jul 2005
Reputation Points: 739
Solved Threads: 396