read and compare with file i/o

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void batch()
{
    char word[25];
    while(!indata.eof())
    {
        indata >> word;
        cout << word << endl;
        if (word == "help")
        {
            help_cmd();
        }
        if (word == "version")
            version_cmd();
            indata >> word;
    }
}


is word not being compared with the string "help", and that is why my help function is not executing?
"==" does not work with c-strings. Either make word a string (std::string word; or use the cstring library's method strcmp.
Topic archived. No new replies allowed.