Prova così :
codice:#include <stdio.h> #include <stdlib.h> int main() { int a; FILE *f = fopen ("list.txt", "r"); fscanf (f, "%d", &a); while (!feof (f)) { printf ("%d\n", a); fscanf (f, "%d", &a); } fclose (f); system ("pause"); return 0; }
Prova così :
codice:#include <stdio.h> #include <stdlib.h> int main() { int a; FILE *f = fopen ("list.txt", "r"); fscanf (f, "%d", &a); while (!feof (f)) { printf ("%d\n", a); fscanf (f, "%d", &a); } fclose (f); system ("pause"); return 0; }
Experience is what you get when you don’t get what you want