Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need conversion for 2 and 4 byte Btrieve numeric fields.
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Need conversion for 2 and 4 byte Btrieve numeric fields.
Divers
Thread ID:
00918929
Message ID:
00918929
Vues:
42
I am attempting to convert data from old Btrieve files into VFP. I found a great freeware tool that will dump any .BTR file out with an ASCII string for each record but the numeric fields are not converted. Using FoxPro it is very easy to parse the string into VFP fields but I am having trouble converting the 2 and 4 byte numeric fields.

For example two bytes containing the number 1 come out with values of 128 and 63. The number 6 comes out as 192 and 64. I can convert the 4 byte numbers using the following code which I have used in other conversions with no problems. However, the negitive numbers are all whacked.

mNum = (asc(fread(mHand,1)) ;
+ (asc(fread(mHand,1)) * 256) ;
+ (asc(fread(mHand,1)) * 65536))
x = fread(mHand,1)
if asc(x) >= 128
mNum = mNum - 167772.16
endif


Does anyone know where I can find code that will convert these numbers to decimal?
TIA
Beer is proof that God loves man, and wants him to be happy. - Benjamin Franklin
John J. Henn
Répondre
Fil
Voir

Click here to load this message in the networking platform