Joe:

> testCode(unsigned char buf, unsigned long len)
> {
>     unsigned long data=0x0;
>     while (len--)
>     {
>         *buf++ = (unsigned char)data++

   This C code will crash since buf is declared as an unsigned char, not 
an unsigned char*. Stop thinking in terms of translating low level C 
because Python is a higher level language and does not have machine 
address pointers. You should be implementing the intent of your design 
which we can't determine from tiny incorrect snippets. For example, we 
can't determine if the intent is to create a new string, translation: 
''.join([chr(x) for x in range(len)]), or if you are modifying an 
existing sequence or inserting into a sequence. It is also impossible to 
tell if you should be using a list, array or string for this job.

   Neil
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to