Re: sscanf in c#




"AMP" <ampeloso@xxxxxxxxx> wrote in message
news:1158700185.489264.165290@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
| Hello,
| I am the OP.
| I am beginning to understand but I have the following:
| sscanf(strdata[1], "%lx\n", currentAddr);
|
| currentAddr is an unsigned long in c(which is a uint in c#) 4 bytes,
| correct?

Yep.

| I am trying to get the hang of this, but I could use an example with
| something I'm using.
as per my previous sample...

uint currentAddr;
string strData = " ff12fffe ";
bool result = UInt32.TryParse(strData.SubString(1), NumberStyles.HexNumber,
null, out currentAddr);
if(result)
// parsed correctly.
else
// failed to parse.

or, you can use the Parse method.

try {
hexVal = UInt32.Parse(installResult.Substring(1),
NumberStyles.HexNumber);
}


Willy.


.