Great thanks Alex and Maciej. ffi.buffer works as expected. On Thu, Nov 19, 2015 at 2:04 PM, Maciej Fijalkowski <fij...@gmail.com> wrote:
> Use ffi.buffer and not ffi.string > > On Thu, Nov 19, 2015 at 4:24 AM, Yicong Huang <hengha....@gmail.com> > wrote: > > 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? > > > > > > _______________________________________________ > > pypy-dev mailing list > > pypy-dev@python.org > > https://mail.python.org/mailman/listinfo/pypy-dev > > >
_______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev