#HEX Conversion From BIN
5 messages in this thread
can you help me? I am trying to set a larger string size so that the built in
function C2X() can convert a binary file of 15000 bytes to HEX string. I need
to include this file in an application which will then be converted back to
binary decimal also using AREXX. What can I do to solve this problem? C2X()
breaks after 500 binary characters have been converted to HEX.
Patrick,
To convert a longer string using C2X(), I would suggest using a DO instruction
to iteratively break the string into 500 byte chunks with the substr()
function. You can then concatenate the partial result onto the final result
string.
If the original data is coming from an external file, you could also use the
readch() function to read it in 500 bytes at a time, and then convert each
piece.
-Bill
Hmmm .. surprised to hear about the string limitation. I have read in and
manipulated fair-sized data files (I think up to 20K or so) without having
ARexx cough and sputter .. handy way to clean those ^Z characters from an
XModem-received file. I have many megs of RAM, of course.
Offhand, is there any rule about string size limitations?
–Jim
Some of the string functions that do conversions that increase the length of
the string (e.g. conversion to hex or binary) use an internal buffer area.
Operations that do just character-for-character replacement can often do the
operation in place (if the source string isn't needed any more.)
-Bill
Why do you have to convert all the characters at once?
Make a loop and convert a nice number, maybe 100 charaters, at a time
untill you run out of bytes.
//
\X/ Amiga or bust! Gary Bonnstetter, Bonnsoft