You can get the users input using fgets. Then just compare the string the user gave one char at a time by keeping an index and moving through the string. You can get the next char from an open file by using fgetc.

Code:
for(int index=0;index<256;index++){
     if(fgetc(infile)==UserInput[index])
          //Do something
}
- Sean