My problem is this, I have to count the data of a text file that are separated by a line break. The problem is that when I run it, I get 0 data.
I enclose the code that I wrote, I do not know where the error may be.
#include "head.h"
int main()
{
char aux1,aux2,aux3[7];
int contador=0, j=0, n=0, i=0, t=0;
//Cargando datos
FILE *p;
p=fopen("Estadistica-Localidades-Mendoza.txt","r");
//Comprobando si existe el archivo
if (p==NULL){
printf("El archivo no existe o no se pudo leer...\n");
system("pause");
exit(0);
}
else{
while (!feof(p)){
aux1 = fgetc(p);
if (aux2=='\n')
{
contador++;
}
}
}
printf("Cantidad de datos: %d\n",contador);