I wrote this function to search a text file (which currently just says "cube") for one of the words and then call the corresponding function. However, I am getting the 'Error: No Function Found.' message.
Could anyone help me in identifying my problem?
void read(){
const char cube[4] = "cube";
const char cone[4] = "cone";
const char sphere[6] = "sphere";
const char cylinder[8] = "cylinder";
char line[1024] ;
FILE* fp = fopen("instructions.txt", "r") ;
while (fgets(line , sizeof(line) , fp )!= NULL)
{
if (strstr(line , cube)!= NULL){
void cube();
}
else if (strstr(line , cone)!= NULL){
void cone();
}
else if (strstr(line , sphere)!= NULL){
void sphere();
}
else if (strstr(line , cylinder)!= NULL){
void cylinder();
}
else {
printf("Error: No Function Found./n");
}
}
fclose(fp);
free(line);
return;
}
Aucun commentaire:
Enregistrer un commentaire