I am trying to cast a string pointer of a C style char [] style string (returned from a DLL) to a Python compatible string type. but when Python27 does:
import ctypes charPtr = ctypes.cast( "HiThere", ctypes.c_char_p ) print( "charPtr = ", charPtr )
we get: charPtr = c_char_p('HiThere')
perhaps something should not be judged correctly. My questions:
- how should this charPtr be returned to a printable compatible Python string?
- - is the casting operation just mentioned doing what it should do?
source share