I read input with the following loop
do
{
i=0;
do
{
line[i]=fgetc(stdin);
i++;
}while(i<100 && line[i-1]!='\n' && line[i-1]!=EOF);
//Parsing input
}while(line[i-1]!=EOF);
My input looks like this
$GPRMC,123519,A,4510.000,N,01410.000,E,010.0,010.0,120113,003.1,W*4B
$GPRMC,123520,A,4520.000,N,01650.000,E,010.0,010.0,230394,003.1,W*4B
$GPRMC,123521,A,4700.000,N,01530.000,E,010.0,010.0,230394,003.1,W*4F
$GPRMB,A,0.66,L,001,002,4800.24,N,01630.00,E,002.3,052.5,001.0,V*1D
$GPGGA,123523,5000.000,N,01630.000,E,1,08,0.9,100.0,M,46.9,M,,*68
So my problem is that after the last line, when it should read EOF, it stops on the line line[i]=fgetc(stdin);
. Even if I copy that input from file and paste it to terminal or even if I run that program with < input.txt
in terminal.But when I run it in terminal, paste there input and than manually add EOF
(^D) than it stops.. Can someone tell me where I get problem?