VC++ types to ctypes

Thomas Heller theller at python.net
Mon Jun 12 12:22:37 EDT 2006


lux wrote:
> Hi to all,
> i need to traslate this struct in python using ctypes
> 
> struct Soptions
> {
> char          chVolumeLabel[128];
> __int32      nSessionToImport;
> BS_BOOL bJolietFileSystem;
> BS_BOOL bBootable;
> TCHAR      chBootImage[_MAX_PATH];
> BS_BOOL bFinalize;
> BS_BOOL bTestBurn;
> BS_BOOL bPerformOPC;
> BS_BOOL bVerifyAfterBurn;
> __int32      nCacheSize;
> BS_BOOL bUnderrunProtection;
> BS_BOOL bEjectAfterBurn;
> __int32      nCopies;
> }
> 
> I try to convert:
> 
> char xxx[128] -> c_char*128
> __int32          -> c_int
> BS_BOOL     -> c_byte
> 
> TCHAR      chBootImage[_MAX_PATH]; -> ???
> 
> But not work...
> how to solve it?
> 
> Thank's, Luca
> 

_MAX_PATH is 260.
TCHAR is normally a unicode (wide) or a ascii (ansi) character, depending
on if _UNICODE is defined by the compiler.  Assuming ascii,
TCHAR chBootImage[_MAX_PATH]  -> c_char * 260

Thomas




More information about the Python-list mailing list