End of file reading in c -
my program reading last line of data infile twice. when execute program, last line of data being printed twice. please me! here code,
while ( !feof ( in ) ) { //fread(); }
i hope happens because of feof
functionality.
i don't want use fgets
or getline
. there other way? please direct me.
thanks responded me! got solution this! did fgetc
, unfgetc
in side do
loop.
here code:
int ch; ch=fgetc(fp); { ungetc(ch,fp); //fread(); ch=fgetc(fp); } while( (ch = fgetc(fp)) != eof && ch != '\n' );
this post talks problem facing.
Comments
Post a Comment