Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What exactly is a
Message
 
To
23/11/2004 17:26:01
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00964046
Message ID:
00964468
Views:
9
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
Previous
Reply
Map
View

Click here to load this message in the networking platform