Hey guys, I am trying to write a program that will use command line arguments to detect user inputed keywords in a text file and output how many times the keyword/s appear. The command line should read like this...

programname -f inputfile keyword1 keyword2...keywordN

The problem I have is I do not know how to search the file for a specific string. For instance, if the keyword to search is "the", I do not know how to make the program read the file and search specifically for the string "the." If anyone can help me out, it would be really appreciated, this is killing me. Here is my code so far:

int main(int argc, char *argv[])
int i;

FILE * fptr;
fptr = fopen("myfile.txt","r");

if(fptr == NULL)
cout << "file does not exist." << "\n";

for (i = 1; i < argc; i++)
if (strcmp(argv[i], "-f") == 0)