Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieve byte from string?
Message
From
12/02/2008 09:57:12
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01291798
Message ID:
01291800
Views:
14
>If I have a string created as follows...
>
>x=CHR(255)+CHR(85)+CHR(0)+CHR(16)+CHR(0)+CHR(0)
>
>
>What is the fastest way to retrieve a specified byte as an integer?
>
>bytenum=2
>? asc(substr(x,bytenum,1))
>
>...is all I could think of.
>
>
>FYI - This is a value returned from an api call. In vb I could use a struct but as far as I know vfp has nothing like that.

See all the difernt BITxxx-functions in help, in this case you can use BITTEST()

Update, I mesread BYTE as BIT. For bytes the substr() function is easiest, just as you showed.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform