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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -