Here is my code
#include<stdio.h>
int main()
{
FILE *fp;
int x,y,t,q;
char ch;
fp=fopen("sth.xyt","r");
while ((fscanf(fp,"%d %d %d %d",&x,&y,&t,&q))!=0)
printf("x=%d y=%d theta=%d quality=%d\n",x,y,t,q);
ch=getchar();
// fscanf(fp,"%d %d %d %d",&x,&y,&t,&q);
// printf("x=%d y=%d theta=%d quality=%d",x,y,t,q);
fclose(fp);
return 0;
}
Here sth.xyt has multiple lines.
Each line contains 4 number separated by spaces.
example
115 757 180 6
144 191 214 17
170 114 202 6
182 253 236 80
195 377 56 83
The problem is that loop is running infinitely .
Also I used getchar so that when user presses enter key then next line is read from file . That's not happening .
Currently my output is
an infinite series of
x=195 y=377 theta=56 quality=83