473,396 Members | 1,895 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

VC++ types to ctypes

lux
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

Jun 12 '06 #1
2 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

Jun 12 '06 #2
lux
Thank you now it work!!!
Thomas Heller ha scritto:
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


Jun 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden, Thomas Heller, and Mark Hammond for your earlier help...
5
by: Torsten Bronger | last post by:
Hallöchen! I have to generate a lot of data types (for ctypes by the way). An example is ViUInt32 = u_long ViPUInt32 = POINTER(ViUInt32) ViAUInt32 = ViPUInt32 Therefore, I defined...
1
by: Srijit Kumar Bhadra | last post by:
Hello, Here are code snippets to create and access shared memory in Python with and without ctypes module. With regards, Srijit Filename : SharedMemCreate.py import msvcrt, mmap
1
by: Steve | last post by:
We are considering the ways to migrate our VC++ 6.0 applications to .NET platform. It would be nice to rewrite them completely in C#, but due to the time constraints this option is out of...
8
by: ramu | last post by:
Hi, I want to call a vc++ function from a c program on linux. So when I do this dosen't the VC++ datatypes differ with c datatypes. Because we don't have some vc++ data types in c. I have to...
1
by: sjdevnull | last post by:
Hey, I'm trying to wrap GNU readline with ctypes (the Python readline library doesn't support the callback interface), but I can't figure out how to set values to a variable inside the library. ...
6
by: Jack | last post by:
I'm not able to build IP2Location's Python interface so I'm trying to use ctypes to call its C interface. The functions return a pointer to the struct below. I haven't been able to figure out how...
0
by: Egor Zindy | last post by:
Egor Zindy wrote: #!/usr/bin/env python """ A generic chipid library based on ctypes This module handles most of the functions in FTChipID.dll
3
by: Andrew Lentvorski | last post by:
Basically, I'd like to use the ctypes module as a much more descriptive "struct" module. Is there a way to take a ctypes.Structure-based class and convert it to/from a binary string? Thanks,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.