Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Conteo De Caracteres

DZone's Guide to

Conteo De Caracteres

·
Free Resource
Este pedazo de codigo cuenta los caracteres de un archivo

this code count the chars of a file.


#include 
  
   
#include 
   
    

int main(int argc, char *argv[])
{
    int cont[257];
    int t;
    FILE *ent;
    
    for (t=0;t<257;t++)
        cont[t]=0;
      
    ent=fopen("input.txt","r");
//    printf("Se abrio el archivo :P\n");
    do {
        t = fgetc(ent);
        cont[t]++;
    } while (!feof(ent));
    fclose(ent);

    for (t=0;t<257;t++){
        printf("Caracter %i se repitio %i veces\n", t, cont[t]);
    }

    
//  system("PAUSE");	
  return 0;
}


   
  
Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}