I am trying to write a program that takes 4 parameters. filename, line to start reading, line to end reading, and a keyword to match in the file. The output should give how many found per line and how many in the whole file.

This is what I got to now, Help please, I'm lost here, and yes, it is an assignment for school...

nt main(int argc, char *argv[])
{
if(argc != 5)
{
cout<<"Could not run program, quiting:"<<endl;

exit(0);
}

ifstream fin(argv[1]); //file open

if(fin.fail())
{

cout << " Failed to open input file!\n";

exit(1);
}

int line_start = atoi(argv[2]);
int line_total = atoi(argv[3]);



char let;
int ls = 1, tl = 1;
while(!fin.eof())
{

int line = 1, total = 1;
for(int i =1;i < line_start; i++)
{

for(int x=line_start; x<=line_total;x++)
{
fin>>let;
cout<<let;
}
if(strcmp(let, arg[4]) == 0);
line++;
cout<<"line"<<line<<endl;

}
if(strcmp(let, arg[4]) == 0);
total++;
cout<<"total"<<total<<endl;
}


system("PAUSE");
return 0;
}