I need help! What I want to do is to copy and paste the code of fucntions into an array of some sort and execute, through function pointers, the new code inside the array. (I'm not a hacker, btw). I also want to remove the return statements when copying the functions so I can add others. For example:
void a()
{
printf("hello");
}
voit b()
{
print(" world\n");
}
I want in a char array:
{ code for a minus the return statement, code for b normally }
Then with a function pointer to that array, I can hopefully execute the new combined code.
So say we have:
void m()
{
printf("HELLO!\n");
}
void f() { }
.....
// no casting is done here for reading's sake
char *s=new char[1000];
memcpy(s, &m, &f-&m);
void (*go)(void)=s;
go();
// prints out "HELLO"
...
I would want to do all this in a class too (like the functions being member functions).
HELP ME! HOW TO DO?
I bet you advanced coders know how to do all this, LOL!