C type buffer copy
Ivan Van Laningham
ivanlan at pauahtun.org
Tue Mar 22 14:33:11 EST 2005
Hi All--
def testCode(data):
buf=data[:]
# and I hope you're going to do something with buf,
# because otherwise this function's a bit of a waste;-)
"joe at gmail.com" wrote:
>
> Hello,
>
> How does Python deal with C type memory buffers. Does Python return
> everything as an object irrespective of the data type?
>
> Here's what i am trying to achieve?
>
> testCode(unsigned char buf, unsigned long len)
> {
> unsigned long data=0x0;
> while (len--)
> {
> *buf++ = (unsigned char)data++
> }
> ....
> }
>
> What's the best way to deal with this in python?
>
Metta,
Ivan
----------------------------------------------
Ivan Van Laningham
God N Locomotive Works
http://www.andi-holmes.com/
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps: Cu Chi, Class of '70
Author: Teach Yourself Python in 24 Hours
More information about the Python-list
mailing list