All pastes #45812 Raw Edit

Tau

public c v1 · immutable
#45812 ·published 2006-03-15 16:00 UTC
rendered paste body
#include <stdio.h>#include <stdlib.h>void list(char *arquivo,char *vetor);void imp(char *vetor,unsigned long int x);int main(int argc, char *argv[]){  if(argc<3)  {   printf("Falta de argumentos\n");   exit(0);  }    list(argv[1],argv[2]);    return 0;}void list(char *arquivo,char *vetor){  FILE*fp=fopen(arquivo,"rb");  unsigned long int x=0;    int i=0,j=strlen(vetor);    if(fp==NULL)  {   printf("Erro ao abrir o arquivo\n");   exit(1);  }  while(!feof(fp))  {   if(vetor[i]==getc(fp))   {     i++;    if(i==j)    {     x++;     i=0;    }   }   else    i=0;  }  imp(vetor,x);  fclose(fp);}void imp(char *vetor,unsigned long int x){  printf("%s:%lu\n",vetor,x);   }