My main() should get an address as input which needs to be stored in void*
address.
int main(int argc, char *argv[])
{
if (argc > 1) {
HandleStr = argv[1];
printf("\n Handle passed : %s\n",HandleStr);
}
}
I want this HandleStr as type void *
. How can I do that?
Now, I want to run the exec as ./testapp "0xaf6e9800"
If you have a C99 compiler, you should :
argv[1]
as an hexadecimal number into anintptr_t
void *
Something like :
But beware : you should know what is that value and how it should be used in your program. Because as said by Joachim Pileborg, a process cannot access any memory value.