I created a class in C++ called Commands (file name commands.cpp).
I've taken that and put it into a command array (file name test.cpp).
What I would like to know is how to call the functions that are within the Commands class.
for example I have a function within the Commands class called
void command::init(char data[])
{
//detail
}
and what i have tried to do to call the function is
EDIT
Class test{
int CmdCount; // number of commands in the array
int MaxCmds; // max amount of commands allowed
command* cmds;
Public:
int get_command_count() const{
return CmdCount;
}
int readfile(const char fname[]){
char line[161];
FILE* fp;
fp = fopen(fname, "r");
if(fp){
for(int i = 0; 1 == fscanf(fp, "%160[^\n]\n", line; i++){
cmds[get_command_count()].init(line);
CmdCount += 1;
}
}
fclose(fp);
}
};
I just want to know how to be able to call void command::init(char data[]).
Any suggestions?
thanks.