The information in this article applies to:
SUMMARYVisual FoxPro 5.0 and 6.0 allow you to convert between hexadecimal and decimal values using Xbase code. MORE INFORMATIONVisual FoxPro 5.0 and 6.0 help you easily convert between decimal and hexadecimal numbers. The following examples demonstrate how to gain decimal output from a hexadecimal number. Type the following lines in the Command window:
The WAIT WINDOW commands report the numbers 255 and 61439. The zero and the
x (0x) in front of the hexadecimal value tells Visual FoxPro to treat the
proceeding values as hexadecimal values.
Additionally, the TRANSFORM() function has a new clause to handle hexadecimal conversions. The following TRANSFORM() functions demonstrate this new functionality. Type the following code in the Command window:
The TRANSFORM() function converts the decimal values back to hexadecimal
form. The zero (0) format code directs the TRANSFORM() function to output
hexadecimal numbers. The output is always an eight-digit hexadecimal value
preceded by 0x.
While these new capabilities are easy to use, earlier versions of FoxPro do not have this functionality. If you need backward-compatible code that converts decimals to hexadecimal values, create a function within Visual FoxPro using the CONVERT() function. For more information about this technique, please see the following article in the Microsoft Knowledge Base: Q95717 How to Convert Decimal Numbers to Hexadecimal Numbers Additional query words:
Keywords : kbnokeyword kbVFp500 kbVFp600 |
Last Reviewed: December 13, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |