I can't seem to get this simple code to work. I want to open a text file and compare each line to a word using this function:
ifstream ifs("wordsEn.txt");
bool findword (string word)
{
    string currentword="";
    if (!ifs.is_open()) {
        cout << "error" <<endl;
        return false;
    }
    while(getline(ifs, currentword)) {
        if (currentword == word) {
            cout<< "true" <<endl;
            return true;
        }
    }
    return false;
}
Although this should work, this function never returns true. I know this is very basic but I can't find my mistake
 
     
     
    