Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I read a hex value from an ascii file
Message
 
 
To
29/11/1996 07:45:54
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00013211
Message ID:
00013851
Views:
41
>Position 1 will either be a 4 or a c. 4 indicates a positive number and c indicates a negative.
>
>Position 2 gives the number of decimal points.
>
>The following the following five positions are the actual number.

Given those 7 Ascii characters in cMyStr:
cSign=Upper(Left(cMyStr,1))
nDecimals=Val(Substr(cMyStr,2,1))
cDigits=SubStr(cMyStr,3)
nValue=HexToNumeric(cDigits) / (10 ** nDecimals) * iff(cSign="4",1,-1)

you didnt't say if decimal points is given in hex or not but unless the number has more than 9 decimal places it won't matter. Test:
c200431 would be -10.73
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform