this is the code#include #include
FILE *fpin, *fpout;
printf("Please enter the file name
if((fpin=fopen(filename,"r")) == NULL)
printf("Couldnt open file %s for input
if((fpout=fopen("res.txt","w")) == NULL)
printf("Couldnt open "res.txt" for output
while ((ch=getc(fpin)) != EOF)
if( ch == '
$ more input.txt
this is the first line
this is the second line
this is the third line
$ more res.txt
1 this is the first line
2 this is the second line
3 this is the third line
It seems that something happens and it cant read the EOF char.
OR even it reads it does something wrong.
I cant understand why.
I ve double-checked the input file if it has another new line char but it doesnt have one. I ve checked it with vi as well and there is no other char after the last char.
Could you please help me on this strange issue ?