Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I tried to run the simple example and I get:

  >>> from cffi import FFI
  >>> ffi = FFI()
  >>> ffi.cdef("""
  ...     int printf(const char *format, ...);   // copy- pasted from the man page
  ... """)
  >>> C = ffi.dlopen(None) 
  >>> arg = ffi.new("char[]", "world") 
  >>> C.printf("hi there, %s!\n", arg);
  17

Python 2.7.3rc2

pycparser 2.07

libffi5/libffi-dev 3.0.10-3

Debian with 3.2.0-2-pae x86



Hmmm...

From man 3 printf: "These functions return the number of characters printed (not including the trailing `\0' used to end output to strings) or a negative value if an output error occurs". So the 17 makes sense, but where did the output go?!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: