how to convert ACString to ctypes.c_char_p

sanket sanket.s.patel at
Fri Dec 19 23:01:40 CET 2008

Hello All Experts,

I am quite new to Ctypes. I am using one c library and writing python
bindings for it.
I need to pass a character pointer to one function.

I am reading one mp3 file and decoding it to raw pcm using pymedia.
Now I need to pass this raw data in to a
C function. Here is my code.

# /*********
from ctypes import *
import as codec

dec = None
dm = muxer.Demuxer('mp3')
fp = open('test.mp3', 'rb')
fingerprinting_done = False

while  not fingerprinting_done:
    s =
    frames = dm.parse(s)

    for fr in frames:
        if dec == None:
            dec = codec.Decoder(dm.streams[0])

         r = dec.Decode(fr[1])

         if r and
              # pass this to the C function.
              # is ACString object
              # I cannot do pcm_audio = c_char_p( . gives me
following error
              # TypeError: string or integer address expected instead
of ACString instance

# *************/

I am getting error while converting (which is ACstring object)
in to ctypes.c_char_p.
can you help me solving this problem?

any help would be appericiated,
Thank you,

More information about the Python-list mailing list