Return Char * from C code to Python..

ShinHyun yangsh at imnetpia.com
Fri Feb 21 20:55:50 EST 2003


Hi..

I have trying to combing python and C codes...
But, I've big(?) problem in returning char * (or unsigned char *) from C code...

For example...

unsigned char *foo1(unsigned char *a, int b)
{
    int                    status = 0;
    unsigned char buffer[100];
    unsigned char *p;

    p = buffer;

    memcpy(buffer, a, b);
    ....
       
    
    return p;
}

or...

int foo2(unsigned char *a, int b)
{
    int                    status = 0;
    unsigned char buffer[100];

    memcpy(buffer, a, b);
    ....
    memcpy(a, buffer, strlen(buffer));
       
    
    return status;
}


I refered Swig manual and some web site...but, I can't understand exaclty..
Please help me..

Thank you in advance....
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20030222/a58271c9/attachment.html>


More information about the Python-list mailing list