/tags/ttn-post-libtool-1-4-3-upgrade/SWIG/Examples/python/varargs/runme.py
Python | 34 lines | 11 code | 16 blank | 7 comment | 2 complexity | 1201bd91f72b9999dd7f28dd43044be1 MD5 | raw file
Possible License(s): LGPL-2.1, Cube, GPL-3.0, 0BSD, GPL-2.0
1# file: example.py
2
3import sys
4import example
5
6# Call printf
7example.printf("Hello World. I'm printf\n")
8
9# Note: We call printf, but use *python* string formatting
10for i in range(0,10):
11 example.printf("i is %d\n" % i)
12
13# This will probably be garbled because %d is interpreted by C
14example.printf("The value is %d\n")
15
16# Call fprintf
17example.fprintf(sys.stdout,"Hello World. I'm fprintf\n")
18for i in range(0,10):
19 example.fprintf(sys.stdout,"i is %d\n" % i)
20
21# This won't be garbled since %d is not interpreted
22example.fprintf(sys.stdout,"The value is %d\n")
23
24# This function calls our NULL-terminated function
25
26example.printv("Hello","World","this","is","a","test.")
27
28
29
30
31
32
33
34