I'm not sure exactly what you are looking to do here, but if your trying to find DOG in the each line check out then you probably want something that looks like this:
Code:
void check(FILE *file)
{
char buf[100];
char store[100][100];
int n=0;
char *token;
char *name="DOG";
while(fgets(buf,sizeof(buf),file)!=NULL){
strcpy(store[n],buf);
n++;
}
while(n>=0){
token=strtok(store[n]," ");
do {
printf ("Token = %s\n",token);
if(strncmp(token,name,strlen(name))==0){
printf("BINGO");
}
} while ((token = strtok(NULL," ")) != NULL);
n--;
}
}
I attempted to use the function you provided and while it didn't compile (missing a semi-colon) it also didn't seg fault when I fixed it. I also switched the strcmp to a strncmp as it is always better to use the strncmp (much safer).
PS. Please use code blocks when you post code, it makes it easier for us to see!