Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting Hex data out of a file into a string
Message
De
18/10/2000 17:42:59
Josh Fedke
National Financial Corporation
Milwaukee, Wisconsin, États-Unis
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Getting Hex data out of a file into a string
Divers
Thread ID:
00431199
Message ID:
00431199
Vues:
43
I'm trying to get the size of a image file using the bytes in the header. What I can't seem to negotiate is that fgets() translates the bytes it pulls from the file into their ASCII equivalent.
I just want the the hex values because I need to swap an upper and lower byte (endianess?) before doing evaluate("0x" + hex_size). In C/C++ you can change the stream extraction type or cast the extracted values. Can Foxpro do something like this, so that hex values can be extracted from a file?
Also, " alltrim(str(asc(fgets(file_handle,1)))) " doesn't work because when hex A-F appear, fgets doesn't convert them to a valid ASCII character and then " alltrim(str(asc( " won't work correctly. Thanks in advance.

-Josh
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform