/* A pointer to an open file must be passed */ long nol(FILE *f) { long current_position = ftell(f); fseek(f,0L,SEEK_SET); for(int nol = 0; !feof(f) ; ) { if(fgetc(f)=='\n') { nol ++ ; } } fseek(f,current_position,SEEK_SET); return nol; }