I have to write a program that determines the frequency of a letter specified by the user in an input file. I am kind of stuck. I know I have to write a user defined program, to count the total number of letters, but I'm just not sure how to do that for a file. This is what I have so far, if anyone could point me in the right direction that would be great.
Thanks
#include <stdio.h>
int count(FILE *filePtr, int *allCount, char letter);
void totalLetters(FILE *filePtr, int *count, int *allCount, char letter);
int main()
{
int allCount;
char letter;
FILE *inFilePtr;
inFilePtr = fopen("file1.txt", "r");
count(inFilePtr, allCount, letter);
printf("There are %d characters in the file\n", count);
printf("Enter a letter:");
scanf("%c", &letter);
return 0;
}// end main function
int count(FILE *filePtr, int *allCount, char letter) // function definition
{
int allCount=0;
FILE *inFilePtr;
while( !feof(inFilePtr)){ //I'm not sure if this is how you count the number
allCount++ ; of letters