Home AMX User Forum AMXForums Archive Threads Tips and Tricks

Make hex to ascii

Dear All,
could you please help me on the below issue ?
I have a hexadecimal array Buffer[] = $00,$00,$00,$00,$00,$05,$00,$03,$02,$12,$34
What I need to do is to get the two last hex's, buffer[10] = $12 and buffer[11] = $34 and calculate the decimal number of the hex $1234 ( 4660d ). Using the hextoi('1234') is the goal but HOW can I make the buffer[10] and buffer[11] to be the ASCII of '1234' ?

Thanks,
George

Comments

  • DanielDaniel Posts: 9
    value = ( buffer[10] * 256 ) + buffer[11]
    Not sure why you need ASCII there.
    If you need to convert your value to an ASCII string to show on a text field: itoa(value)
Sign In or Register to comment.