caspita con la fgetc mi legge correttamente l' EOF...
forse non è possibile con la fscanf.
beh devo usare la fgetc mi sa.
codice:#include<stdio.h> #define FNAME "costituz.txt" int main () { FILE * punt; punt= fopen(FNAME, "r"); int i, nr; char c; i= 0; nr= 0; while ( c!= EOF ) { c= fgetc(punt); // fseek(punt, i, SEEK_SET); // fscanf(punt, "%c", &c); if ((c=='r') || (c=='R')) { nr++; } i++; } printf("\nCi sono %d lettere nel file FNAME e %d lettere r", i, nr); getchar(); fclose(punt); }