Home AMX User Forum AMX Technical Discussion
Options

Opposite of RAW_LE ?

Is there a built-in command for this? I need to turn "ABCD" into a Long 44434241, and then ITOA that to get "1145258561"

Sometimes I wonder about hardware vendors...

Comments

  • Options
    PhreaKPhreaK Posts: 966
    You can use string_to_variable and variable_to_string to decompile and recompile your variables.
  • Options
    No built in function, but this should do it.
    DEFINE_FUNCTION CHAR[10] CONVERT(CHAR STR[4])
    {
        RETURN ITOA((STR[4] << 24) | (STR[3] << 16) | (STR[2] << 8) | STR[1]);
    }
    

    Chuck
  • Options
    travistravis Posts: 180
    ah thanks, I ended up with something like that, but in more steps. For some reason in my tests it didn't seem like I could refer to an item in a string like STR[4] and I had to use MID_STRING.
Sign In or Register to comment.