char s[100];
FILE *fp;
fp=fopen("E:\\proyectofinal\\nueve.txt", "r");
fgets(s,100,fp) ;
fprintf(stdout, "%s", s);
fclose(fp);
I want it to scan and print the whole of my file, but it only prints out the first line of it. What am I doing wrong?
char s[100];
FILE *fp;
fp=fopen("E:\\proyectofinal\\nueve.txt", "r");
fgets(s,100,fp) ;
fprintf(stdout, "%s", s);
fclose(fp);
I want it to scan and print the whole of my file, but it only prints out the first line of it. What am I doing wrong?
Try
while ( fgets(s,100,fp) != NULL )
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper
thanks!, that workedOriginally Posted by salem