Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What exactly is a
Message
 
À
23/11/2004 17:26:01
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Database:
Visual FoxPro
Divers
Thread ID:
00964046
Message ID:
00964468
Vues:
8
Thanks, I needed that!:-)

>Albert,
>A word is 2 bytes and dword is 4 bytes = 32 bits integer (quadword 8 bytes).
>Passed in string is I bet a hex string. ie:
>
>FF is 255
>0100 is 256
>FFFF is 65535
>0D is 13 etc
>
>In memory an 32 bits integer is stored as a sequence of 4 bytes (reverse order - low order,high order words). ie: "ABCD" is printable but if it stores an integer then its value is:
>
>asc("A") * 256^0 +
>asc("B") * 256^1 +
>asc("C") * 256^2 +
>asc("D") * 256^3
>
>IOW above function could be:
>
>
>FUNCTION buffer2dword(lcBuffer)
>local lnValue
>lnValue=0
>for ix=1 to 4
> lnValue = lnValue + asc(substr(m.lcBuffer,m.ix)) * 256^(m.ix-1)
>endfor
>return m.lcValue
>
You might call it Str2Int32, Str2Int, Dword2Num, C2Bin etc
>Cetin
Imagination is more important than knowledge
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform