| Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 | 1. Conversion of character #12684 Posted by: Michael S 2009-02-06 00:44:55 Last edited by: Michael S 2009-02-06 00:47:11 (Total edited 1 time) | Stupid question really, but I can't figure this out. I have a byte in a file on my PC that (using a hex editor) is shown as '43'x. This is in fact a length of a record and should convert to 67 (43 hex = 67 decimal).
I've read the data n using CHARIN, but for the life of me, can't figure out how to "convert/use" the hex character so that it becomes a valid decimal, such that I can do something like
rec_length = conversion(my_byte)
record = SUBSTR(record,2)
actual_record = LEFT(record,rec_length)
any help much appreciated | 2. #12685 | Use the VALUEIN function to read in that byte and automatically convert it to a REXX number. VALUEIN is essentially a call to CHARIN and then C2D. | 3. #12688 | The C2D function should do what you want, however, like Jeff said, the valuein function does it all. Here's an example from reading the beginning of a .wav file, where the format is RIFFnnnnWAVE where nnnn is file length.
/* Read the RIFF chunk */ Riff = charin(inFN,,4) RiffLength = VALUEIN(inFN,, 4) Wave = charin(inFN,,4)Doug | Forum List • Thread List • Refresh • New Topic • Search • Previous • Next 1 |
|
|