int main(int argc, char* argv[]) {
ifstream ifs(argv[1],ios::in);
if(argc!=2) {
cout << "Please type main.exe and file name to run the program! Please Try Again" << endl;
}
ifs.open(argv[1]);
if (!ifs.is_open()) {
cout << "wrong file name! please open again!" << endl;
}
char line[80];
char *point;
while(ifs.getline(line,80)) //problem seem to be here
{
cout << "line =" << line << endl;
point = strtok(line, " ");
while(point!=NULL) {
if (checkdigit(point))
numberofdight++;
else if(checkkeyword(point))
keywords++;
else { }
}
cout << point <<endl;
point = strtok(NULL, " ");
}
}
ifs.close();
}
The program didn't pass through the while loop while(ifs.getline(line,80)). Can someone help me, please? Pretty new to programming. Suppose to store everything from text file in array. TIA