Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I read a hex value from an ascii file
Message
From
29/11/1996 23:33:16
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00013211
Message ID:
00013856
Views:
31
>>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

Mark:

Thanks for your help. I will give this a shot. It is beginning to make a bit of sense.

Thanks again...
jd
Previous
Reply
Map
View

Click here to load this message in the networking platform