haoy People...
I've been making this program to identefy a string in a file, and to write down the raws were it appears...
the problem was that when I wrote just
while(!feof(in))
it would read the last raw (string) twice... say I had 6 lines in the text file.. and the string would be in the 6th one..
I would get - line 6 AND line 7 as an output....
it had something to do with EOF cause after changing it to that:
while(fgetc(in)!=EOF)
{
fseek(in,-1,SEEK_CUR);
i++;
fgets(buf,80,in);
if((strstr(buf,str))!=NULL) arr[i]=1;
else arr[i]=0;
}
it read it fine....
can anyone explain why???
sorry about the long thread...