当年话下
>>> from ctypes import *>>> libc=cdll.msvcrt>>> libc.printf("hello %s\n","world")hello world12>>>>>> p = create_string_buffer("Hello", 30)>>> n=libc.sprintf(p,"hello %s\n","world")>>> n12>>> print p<ctypes.c_char_Array_30 object at 0x02247C10>>>> dir(p)['__class__', '__ctypes_from_outparam__', '__delattr__', '__delitem__', '__delslice__', '__dict__', '__doc__', '__format__', '__getattribute__', '__getitem__','__getslice__', '__hash__', '__init__', '__len__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__setitem__', '__setslice__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__','_b_base_', '_b_needsfree_', '_length_', '_objects', '_type_', 'raw', 'value']>>> p.value'hello world\n'>>>