Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I read a hex value from an ascii file
Message
De
23/11/1996 16:11:04
 
 
À
23/11/1996 13:39:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00013211
Message ID:
00013271
Vues:
34
>>Function HexToNumeric
>>parameter s
>>s=Upper(s)
>>Local x,p,tot,d
>>x=len(s)
>>p=1
>>tot=0
>>do while x > 0
>> d=asc(substr(s,x))
>> d= iif ( d > 64, d-55, d-48)
>> tot = tot + d * p
>> p = p * 16 && or you can bitshift left 4 if you want
>> x = x - 1
>>enddo
>>return tot

>This is good only if the hex value is an integer value. It doesn't work if it is a float.
>
>Vlad

Vlad, the function name speaks for itself: it doesn't deal with float :)
Some things are better be left unknown...NOT!!!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform