Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to define data type for integer,binary & hexadecima
Message
De
24/01/1999 15:41:18
 
 
À
24/01/1999 13:40:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00179567
Message ID:
00179609
Vues:
37
>Ed Rauh,
> I have a problem to pass a hexadecimal parameter in VFP but in Vb that is ok, why ?
> Below is VB code :
>
>>Dim PortAddress As Integer
>>Dim nData As Integer
>>PortAddress = &H2E3
>>Out PortAddress, 128
>>PortAddress = &H2E0
>>nData = 1
>>Out PortAddress, nData
>>text1.text= Inp(PortAddress)
>
> Do you know how to pass a hexadecimal value of "&h2E3" to the PortAddress in VFP ? When i display the return value from Inp(PortAddress), it is not the actual value i want that is not an integer!!
>how to solve it ?

VFP represents hexidecimal notation in constants by prefixing with 0x; for example:

? ox2E3 && prints out 739

In your case, Out(0x2E3,128) would send 128 (0x80) out port 0x2E3 (739 decimal). To read from port ox2E0, you'd say Inp(0x2E0).

Numbers by default are displayed in decimal notation. To display a number in hexidecimal format, use the TRANSFORM() function with the '@0' argument for formatting. For example, to display 739 in hexidecimal notation:

? TRANSFORM(739,'@0) && prints 0x000002E3
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform