Code:#include <stdio.h> void main(void){ int lines=0; char tmp[256]; int maxwidthofline = 132; // put the max line len here FILE *in; in = fopen("myfile.dat","r"); while (!feof(in) ) { if (fgets(tmp,maxwidthofline,in) != NULL ) lines++; } fclose(in); printf("%d\n",lines); }




Reply With Quote