diff options
Diffstat (limited to 'demo/pwuid.py')
-rw-r--r-- | demo/pwuid.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/demo/pwuid.py b/demo/pwuid.py new file mode 100644 index 0000000..5ed704e --- /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) |