python - CFFI: TypeError: initializer for ctype 'char[]' must be a bytes or list or tuple, not str -


using cffi library python, i'm trying coax python string char*, can pass c function accepts char*. can't seem figure out right incantation is.

consider example:

>>> cffi import ffi >>> ffi = ffi() >>> ffi.new("char[]", "bob") 

the result is:

typeerror: initializer ctype 'char[]' must bytes or list or tuple, not str 

the following not work either:

>>> ffi.new("char*", "bob") 

it says:

typeerror: initializer ctype 'char' must bytes of length 1, not str 


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -