I have a text file containing the following:
ANT. Small insect, sometimes has wings on its back. BEAR. Large beast.
I have a c program:
int main(void)
{
FILE *fp;
int c;
fp = fopen("myfile.txt","r");
if(fp == NULL)
{
perror("Error in opening file");
return(-1);
} do {
c = fgetc(fp);
if(feof(fp))
break ;
if (c != '\n')
printf("%c", c);
}while(1);
fclose(fp);
}
However it only prints:
BEAR. Large beast.
I want it to print:
ANT. Small insect, sometimes has wings on its back. BEAR. Large beast.