This is what I have now:
Code:
int varCount(FILE *a_file)
{
FILE *lookup=NULL;
lookup=fopen("lookup.txt","r");
char curr_var[10];
char c[10];
char *pch;
int var=0;
while(fgets(curr_var, 10, lookup)) //current value from lookup
{
while(!feof(a_file)) {
fscanf(a_file, "%s", c); //get string from file
pch = strstr(c,curr_val); //look for curr_val in c
if(pch==curr_val){ //if curr_val in string then increment val
var++;}
}
}
return(var);
}
but I get an error message at "pch = strstr(c,curr_val);" saying "curr_val undeclared (first use in this function)
What have I done wrong?