paperlined.org
apps > autohotkey > my_public_code
document updated 16 years ago, on May 18, 2008
; Dump the contents of a "structure" (string).
; StrLen() doesn't work on "strings" that have 0x0s in them, so you have to specify the length.
DumpBytes(ByRef str, len) {
    f := A_FormatInteger
    SetFormat, Integer, hex
    Loop,%len%
    {
        char := SubStr("0" . SubStr(NumGet(str,A_Index-1,"uchar"),3),-1, 2)
        display := display . " " . char
        if (mod(A_Index, 8) == 0)
            display := display . "`n"
        else if (mod(A_Index, 4) == 0)
            display := display . "  "
    }
    MsgBox,%display%
    SetFormat, Integer, %f%
}