I am using fscanf to read the input
(2,3)
(3,4)
from a file but it goes into an infinite loop whenever I run the program. The input is from a file say abc.txt which must be passed as a command line argument. The code is give below
#include<stdio.h>
#include<stdlib.h>
int main(int argc,char **argv){
int a,b;
FILE *fp=fopen(argv[1],"r");
while(!feof(fp)){
fscanf(fp,"(%d,%d)",&a,&b);
printf("\nThe values are :%d %d\n",a,b);
}
fclose(fp);
}
What might be the problem?