GP32 Copying Chunks Of Unsigned Chars


Blah

Wanna Be Programmer
Joined
Dec 18, 2003
Messages
3,253
Age
34
Location
Oregon, USA
Website
Visit site
I need to copy around chunks of a unsigned chars, and the whole of them sometimes of course. Also I need to copy around chunks of data using char pointers (char*). How do you do this? (I can do other things so you don't need to dumb it down too much)
 
Ok, figured out it was memcpy I needed to use. But I don't know how to use it to copy when there is an offset to be factored in...Help...
 
Ok, I figured it out, no thanks to any of you <_<

j/k

Anyway, for future reference, here's how its done:

memcpy(data1+offset,data2+offset,size);
 
You can also use arrays to accomplish the same thing, which, at times, makes things easier to read:

memcpy(&data1[offset], &data2[offset], size);
 
Squidge posted on Apr 29 2005 at 01:22 AM said:
You can also use arrays to accomplish the same thing, which, at times, makes things easier to read:

memcpy(&data1[offset], &data2[offset], size);

Hmmm...That didn't work for me, but then again I'm using the asm memcopy lib that the Netbsd foundation made.

edit: Oh, didn't notice the & symbol, that's why...

Thanks for the help anyway.
 
Last edited by a moderator:
Back
Top