I'm trying to read each character from a file and print it to the screen using getc and putc alone. Here's my code,
FILE *fp = fopen("new.txt","r+");
rewind(fp);
while( feof(fp) == 0 )
{
putc( getc(fp) , stdout);
}
When ever I execute this, it runs into an infinite loop. I can't understand how this happens when the file is only a few lines long.
Newbie.