Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Retrieve byte from string?
Message
De
12/02/2008 09:57:12
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01291798
Message ID:
01291800
Vues:
13
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform