Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > WindowsXP/ CTypes - How to convert ctypes array to a string?

Reply
Thread Tools

WindowsXP/ CTypes - How to convert ctypes array to a string?

 
 
dudeja.rajat@gmail.com
Guest
Posts: n/a
 
      08-19-2008
Hi,

I've used CTYPES module to access a function from a dll. This function
provides me the version of the dll. This information is accessible to
me as an array of 4 long inetegers. information as :
2, 1, 5, 0


I want to display these elements concatenated as "v2.1.5.0". This
string ( I'm thinking of writing the above 4 array elements to a
string) is to be displayed as label in a GUI ( the GUI used is Tk)

Please suggest how can I write these elements to a string to get me
the desired results as "v2.1.5.0". And, is writing to a string is
right way?

PS: this string also needs to be displayed in the GUI label well.


FYI, the code written to access function from dll is as under:
********
from ctypes import *
abc = windll.af1xEvdoRDll
GetVersion = abc.af1xEvdoRDll_GetVersion
print GetVersion
versionArr = c_long * 4
version = versionArr(0, 0, 0, 0)
GetVersion(version)
print version
for i in version: print i

*************
Results are : 2, 1, 5, 0

Cheers,
Rajat
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Convert ctypes 16 bit c_short array to a 32 bit numpy array Wanderer Python 1 03-24-2011 07:45 PM
how to convert pymedia.audio.acodec ACString to ctypes.c_char_p sanket Python 0 12-19-2008 10:01 PM
[ctypes] convert pointer to string? Neal Becker Python 4 05-21-2008 04:54 PM
RE: [ctypes-users] [Ann] ctypes 0.9.0 released Henk Punt Python 0 07-23-2004 10:34 PM



Advertisments