January 2000
Intermediate to advanced
672 pages
21h 46m
English
WinDLL also includes a class
cstring
that makes it easy to pass string or
character buffer arguments back and forth. This class should be
initialized with a Python string (which may be empty), and an
optional length. Internally, cString maintains a
buffer with a null-terminated string and the address of the buffer it
passes to the DLL when used as an argument. To test this, the DLL
exports a function
StringRepeat
that repeats a string a number of
times:
>>> inBuf = cstring('spam') # make a buffer holding a c string
>>> outBuf = cstring('',50) # make another big enough for output
>>> mod1.StringRepeat(inBuf, outBuf, 10) # returns the length of out string
40
>>> outBuf
'spamspamspamspamspamspamspamspamspamspam'Rather than go any further, you can refer to the documentation and
examples in the CallDLL and
DynWin packages.
Read now
Unlock full access