I am reading a file character by character and comparing it to ascii values. At the moment I am specifying the file to read myself, but what if I wanted the user to input their own file for my program? example my code below uses fopen("myFile.txt","r");
but I would like the user to pick their own file and redirect into my program. ex. a.out < myFile.txt
#include <stdio.h>
#include <stdlib.h>
int main(){
FILE *myFile = fopen("myFile.txt", "r");
double count=0;
char single;
while((single=fgetc(myFile))!= EOF){
if(single=='a'|| single == 'A'){
A++;
count++;
}
}
return 0; }