python ctypes cast get null string
b is address
if b_v.value is a common character, this is normal.
But if b's content is hex like "1122001314" Long as it contains hex "00"
the result maybe is 1122 the 001314 should be lose
Now I want get all content "1122001314". Please give me some method thanks.
the code is:
b_v=ctypes.cast(b,ctypes.POINTER(ctypes.c_char_p))
print binascii.b2a_hex(b_v.value)
example:
import ctypes
import binascii
va=binascii.a2b_hex('1212273031003535')
tt=ctypes.create_string_buffer(va)
b=ctypes.addressof(tt)
b_v=ctypes.cast(b,ctypes.c_char_p)
print binascii.b2a_hex(b_v.value)
now the result is :"1212273031"
i want the result is "1212273031003535"