Hi everyone.
I have to do the following for my project,
You are required to develop a program to search a test file for the number of occurrences of at least two words. Output from the program should be produced both on the display and held in second text file.

The input file, output file and the search words should be specified as command line arguments for the program.
i.e mysearchprog inputfile outputfile the but

where mysearchprog is the name of the program, inputfile and outputfile are the names of the input and output files and the and but are the search words.

Hint :
Your application should contain a number of functions.
Remember that words in the text file can be terminated with spaces, commas, full stops, etc.

I don't quite understand the command line arguments and how they're excecuted.
I've written the code below,it opens a file and gives the number of occurrence of 1-letter word , 2-letter word and so one,
how can I use the command line arguments and how can I search for specific words like the, but.
can someone one help me please.

Code:
#include "stdafx.h"
#include <stdio.h>
#define LEN_TOTAL 21

int _tmain(int argc, _TCHAR* argv[])
{
	 int word_length_occurrence[ LEN_TOTAL ] = { 0 };
	 char string[700]={0},
	      tempStr[300]={0},
		  *tokenPtr;
	   size_t i,
          maxLength = 0;
	
        
	 FILE * pFile;
            pFile = fopen ("input.txt","r");
     if (pFile==NULL) perror ("Error opening file");
  else
  {
     
	 while (fgets( tempStr, sizeof( tempStr ), pFile ) != NULL)
{
	  strcat( string, tempStr );
}
		   tokenPtr = strtok( string, " \n" );
	
	  while ( tokenPtr != NULL ) {
      maxLength = strlen( tokenPtr );
      word_length_occurrence[ maxLength ]++;
      tokenPtr = strtok( NULL, " ! -.,\n" );
	 }
      printf( "%8s%15s\n", "Word Length", "Occurrences" );

	  for ( i = 1; i < LEN_TOTAL; i++ ) 
      printf( "%4d%15d%c", i, word_length_occurrence[ i ], '\n' );
	  
  
	printf( "\n" );
    getchar();
	fclose (pFile);
}
   
FILE * pFile2;
		pFile2 = fopen ("output.txt","w+");
		if (pFile2 != NULL) {
		fprintf( pFile2,"%8s%15s\n", "Word Length", "Occurrences" );

		for ( i = 1; i < LEN_TOTAL; i++ ) {
      fprintf( pFile2,"%4d%15d%c", i, word_length_occurrence[ i ],'\n' );
	  
		fclose(pFile2);
		}
		}
  

  
  
  return 0;
}