I made an attempt to convert C++'s memcpy function to a Python version of it. Here is my current code:
memcpy doesn't return anything (correct?), my code does however, this is just how I felt like making the code at the time. I got the description of the function from MSDN. It tells me:
# C++'s memcpy function
def memcpy(self, dest, src, bytes):
if(dest < src):
new_dest = src[:bytes];
dest += new_dest;
I did my best at making a copy of the function, I know the code is incorrect, somewhat. However, I am not sure how the actual memcpy function changes the data it receives. My code only fixes the code up (not sure if it's done correctly) and returns the new buffer, but I know there is more to this function than that. Any help on what I'm missing and how the real memcpy function adds to the new destination buffer?
The memcpy function copies count bytes of src to dest.
Edit: I just realized that I misread soething on MSDN. memcpy returns the new value of dest. Which is what my function does. Is my function correct? Or is something wrong still?