All pastes #977626 Raw Edit

Someone

public c v1 · immutable
·published 2008-04-08 23:21 UTC
rendered paste body
#include <stdio.h>#include <string.h>#pragma warning(disable: 4996 4267 4013)/* Declare functions */void Make(char*, char*);int main(int argc, char *argv){    if (argc != 3) {        printf("\n\tUsage: CountLetter filename string\n");        return 0;    }    Make(argv[1], argv[2]);    return 0;}void Make(char* filename, char* compare){    int count = 0, ch = 0, i = 0, len = strlen(compare);    FILE *file;        file = fopen(filename, "r");    if (file == NULL) return;    while (1) {        ch = fgetc(file);        if (ch == EOF) break;        else if (ch == compare[i]) {            i++;            if (i == len) { count++; i = 0; }        }        else i = 0;    }        fclose(file);    printf("There are %d occurences of %s", count, compare);}