I hope it will help you
program is very unflexible but it works (counting lines in countlies.txt)
btw sory for my english I hope you understood what I wished said
#include<stdio.h>
int main() {
FILE* fp;
int i;
fp = fopen("arquivo.txt", "r");
if (fp == NULL)
{
printf("We can't open the file.");
fclose(fp);
return 1;
}
while((fgetc(fp) != EOF) { // while EOF don't count
if (getch (fp) == '/0' || '/n') ++i; //count here only
}
printf("Number of lines: %d\n",i);
return 0; // u are missing this
}