PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/trunk/Examples/python/varargs/runme.py

#
Python | 34 lines | 11 code | 16 blank | 7 comment | 4 complexity | db498f4a867c2293f81979c17ebe03a6 MD5 | raw file
 1# file: runme.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