Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hex as string
Message
De
03/02/2008 12:57:58
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01288749
Message ID:
01288769
Vues:
11
>>>>I see some characters in the VFP hex viewers, and to do manipulation on a file, I need to convert this to a string; e.g.: MyString = chr(0xFF) + chr(0x7F) + ...
>>>>
>>>>I was wondering whether there was a less cumbersome way to express a hexadecimal dump as a string.
>>>
>>>I'm not sure what you're asking. If you do FILETOSTR() the file contens will be in a string.
>>
>>The hex viewer shows me a series of bytes, as hex characters, e.g.:
>>
>>414243, which is equivalent to "ABC".
>>
>>The hex viewer I only use (in this case) to examine the file format.
>>
>>To do a "search-and-replace" (after loading the file with FileToStr()), I might search for the string chr(0x41) + chr(0x42) + chr(0x43), but I was wondering whether there was a less cumbersome form to convert hex digits (the way I see them in the hex viewer) into a standard string.
>
>What VFP version you're using? In VFP9 you can use STRCONVERT, in the previous versions you may want to check Christof's code.

In VFP 9, how would I convert "414243" - the hexadecimal representation of "ABC" - to the desired string, in this case "ABC"?
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform