Posted by Matthew Kaoru Hallberg on 1999-10-28
Hi.
It's me again, and yet another question for all of you.
I solved my struct problem, thanks for the help but now I have a new
question.... (still for visual c++ 6.0)
is it possible to read in more than one line at a time using sscanf?
suppose I have a data file that has contents like this:
F0000000: FF043000 FF043000 00000000 00000000
F0000010: 7F000000 7F000000 FF070000 FF070000
F0000020: 00000000 00000000 A0070000 A0070000
and I want to read in the first occurence of register 8
go to the next line, and read in the occurence of reg 10
like this (don't care about anything else... just those two values):
register10 register 8
F0000000: FF043000 FF043000 00000000 00000000
^^^^^^^^^^^ 1st read
F0000010: 7F000000 7F000000 FF070000 FF070000
^^^^^^^^^^^ 2nd read
F0000020: 00000000 00000000 A0070000 A0070000
//you get the point?....
and store them into the variables: RegFuncData.HiAddr, and RegFuncData.LoAddr
this is what I had prior to finding out I needed to skip the initial register
10 column
while(ar.ReadString(strOneLine))
{
sscanf(strOneLine,"(somehow skip ahead 11 spaces) 8%u (somehow skip
ahead 10 spaces) ", &RegFuncData.LoAddr, &RegFuncData.HiAddr);
// adds the data to the array
m_RegisterArray.Add(RegFuncData);
}
Can anyone help me out with the indicated problems?
I am using visual C++ 6.0, thanks a bunch...
-matt
Matthew Hallberg
Assistant Engineer
Galileo Technologies
408-367-1400 ext 237
matthew@xxxxxxxx.xxx
Previous post | Next post | Timeline | Home