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:
00013816
Views:
30
> > >>This is good only if the hex value is an integer value. It doesn't work if it is a float. > > > >Do you mean that the hex value represents a floating point number stored in a standard format (for example, I think IEEE has one standard)? If so, this can be a real bear to translate because it will have a mantissa component, a sign component, and an exponent component, and the arrangement of the bits depends on whatever standard format is used to represent the number. (My guess is that this is not what you are dealing with). > > Mark: > > Thanks so much for your reply. They this thing was detailed for me, the value (Cougar Mountain Accounting) is stored in the following format: > > 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. > > So far, I am not having a great deal of luck on this end of the project. Any light you could shine on this would be greatly appreciated. > > JD John, 1. Determine the position of the number in the record 2. read the 7? characters as a character 3. strip off the 5 last characters 4. translate them in to decimal number 0..9 a=10 ... f=15 5. take the first number, multiply it by 16^4, the second by 16^3 etc 6. add all these numbers. 7. Divide by 10^ 8. multply by -1 if the first character is C. If your specification is correct, and if I have not made any spec error, you should be OK. HTH, Marc

If things have the tendency to go your way, do not worry. It won't last. Jules Renard.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform