pycurious/fix
diff basic/example.py @ 1:1f54edaaab02
Added SWIG typemap example.
| author | James Brotchie <brotchie@gmail.com> |
|---|---|
| date | Fri Dec 04 22:50:30 2009 +1000 (2 years ago) |
| parents | |
| children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/basic/example.py Fri Dec 04 22:50:30 2009 +1000 1.3 @@ -0,0 +1,19 @@ 1.4 +""" 1.5 +Example to exercise the test SWIG module. 1.6 + 1.7 +""" 1.8 +import os 1.9 +import test 1.10 + 1.11 +# Create and open pipe as file objects 1.12 +(r,w) = os.pipe() 1.13 +fr, fw = os.fdopen(r, 'r'), os.fdopen(w, 'w') 1.14 + 1.15 +# Write and close 1.16 +fw.write('Hello World') 1.17 +fw.close() 1.18 + 1.19 +# Read data from pipe using test module 1.20 +print test.message(fr) 1.21 + 1.22 +
