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

Discussion in 'Python' started by dudeja.rajat@gmail.com, Aug 19, 2008.

  1. Guest

    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
     
    , Aug 19, 2008
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andrew Banks

    Convert string to a string array

    Andrew Banks, Apr 19, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    58,794
    Andrew Banks
    Apr 19, 2004
  2. Replies:
    7
    Views:
    851
  3. Neal Becker

    [ctypes] convert pointer to string?

    Neal Becker, May 21, 2008, in forum: Python
    Replies:
    4
    Views:
    3,840
    Neal Becker
    May 21, 2008
  4. Replies:
    1
    Views:
    404
    Diez B. Roggisch
    Aug 19, 2008
  5. Wanderer
    Replies:
    1
    Views:
    777
    Wanderer
    Mar 24, 2011
  6. S Kanakakorn
    Replies:
    3
    Views:
    516
    Jules
    Feb 9, 2007
  7. Jags Rao
    Replies:
    3
    Views:
    379
    Todd Benson
    Nov 5, 2008
  8. Replies:
    2
    Views:
    353
    John Bokma
    Aug 30, 2013
Loading...