#176999 - blessingta@hotmail.co.uk - Sat Nov 19, 2011 12:11 am
I'm trying to create a function to copy memory for what will be my game saves in bytes. And so far I have been trying to make my algorithm work in c++ but it refuses to work.
the problem is where
its complaining that I'm not allowed to access this.
why is it?
the problem is where
Code: |
*pt_destination++ = *pt_source++; |
why is it?
Code: |
//why wont this function work?
void* memory_copy(void * x_destination, void const * x_source, size_t bytes) { //cast destination to the size of a byte char * pt_destination = (char*) x_destination; //cast source to the size of a byte char const *pt_source = (char const *) x_source; //loop terminates when all the bytes have been copied while (bytes--) { *pt_destination++ = *pt_source++; } return (x_destination); } |