Okay, I'm not sure exactley what this would be called, but I suppose I could say I'm trying to allocate memory for a function.... heres an example:
Code:struct command_type { void (*funp)(CHAR_DATA *ch, char *args); //function }; struct command_type cmd; .... char *com="walk_north"; //name of function to call cmd.function=com; ((cmd.funp))(ch, args); //called the function
Okay, heres my problem. I need cmd.funp to equal the value of the character array 'com'. But they are not the same data types. So how would I allocate the memory of cmd.funp, and then assign the com character string to cmd.funp? Am I making sense?
Remember that if I change the value of com, then funp changes as well, due to using pointers. so I need cmd.funp to not point to com, but be the same value. Thus giving it a function name. -smashes head on moniter-
Thanks for any help, hope I explained it well enough.



LinkBack URL
About LinkBacks


