How to convert C++ char*(contain \0) to python string in PyPy?

Nov. 19, 2015
2:24 a.m.
We used ffi.string() to convert C++ char* to pypy string. But recently, we found out ffi.string() used '\0' as the indicator of string termination. And it bring some problems of converting a binary string. Our case is we read char*(buf) from a binary file, and buf might contain '\0'. Using ffi.string() we were not able to convert completed buf to PyPy string. We've tried ffi.string(buf, length), but it also did not work. Are there any solutions?
3408
Age (days ago)
3408
Last active (days ago)
2 comments
2 participants
participants (2)
-
Maciej Fijalkowski
-
Yicong Huang