Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r345:70864b447bcb Date: 2012-06-14 18:35 +0200 http://bitbucket.org/cffi/cffi/changeset/70864b447bcb/
Log: Add this example from README.md. diff --git a/demo/pwuid.py b/demo/pwuid.py new file mode 100644 --- /dev/null +++ b/demo/pwuid.py @@ -0,0 +1,14 @@ +from cffi import FFI +ffi = FFI() +ffi.cdef(""" // some declarations from the man page + struct passwd { + char *pw_name; + ...; + }; + struct passwd *getpwuid(int uid); +""") +C = ffi.verify(""" // passed to the real C compiler +#include <sys/types.h> +#include <pwd.h> +""") +print str(C.getpwuid(0).pw_name) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit