Good day, here's my code :
FILE* fp;
fp = fopen("a.txt","r+");
if (fp != NULL){
int c = 0;
while(!feof(fp)) {
char k = fgetc(fp);
if (k == '$') {
c = 0;
printf("inside '%c' %d\n", k, c);
continue;
}
c++;
printf("outside '%c' %d\n", k, c);
}
This is the file :
123456$test$pan$test$
The output :
outside '1' 1
outside '2' 2
outside '3' 3
outside '4' 4
outside '5' 5
outside '6' 6
' 7side ' //*
inside '$' 0
outside 't' 1
outside 'e' 2
outside 's' 3
outside 't' 4
' 5side ' //*
inside '$' 0
outside 'p' 1
outside 'a' 2
outside 'n' 3
inside '$' 0
outside 't' 1
outside 'e' 2
outside 's' 3
outside 't' 4
inside '$' 0
outside ' ' 1 //*
I am failing to understand what is happening at //*
Thanks for your help!