Good night, I have a doubt, I have a program that will receive several files of type nome.txt
, and I must count how many characters there are inside the file, I tried to make a prototype but the doubt is in how I will add this using% how do I get a file in txt and then check the characters ??
The following is the code below:
#include <stdio.h>
#include <stdlib.h>
int main (void)
{
int counter = 0;
FILE* file = NULL;
char * arquivo = NULL;
char frases;
size_t aux = 0;
getline(&arquivo,&aux, stdin);
file = fopen("arquivo", "r" );
while(fgetc(file) != EOF)
counter++;
printf("%d", counter);
fclose(file);
}