Python: converting strings for use with ctypes.c_void_p()

前端 未结 1 884
太阳男子
太阳男子 2021-01-05 06:26

given a string:

msg=\"hello world\"

How can I define this as a ctypes.c_void_p() data type?

the follo

相关标签:
1条回答
  • 2021-01-05 07:18

    Something like this? Using ctypes.cast?

    >>> import ctypes
    >>> p1= ctypes.c_char_p("hi mom")
    >>> ctypes.cast( p1, ctypes.c_void_p )
    c_void_p(11133300)
    
    0 讨论(0)
提交回复
热议问题