c++ string::find ... not finding
<p>Im trying to use the string::find method to determine if the string " hello " (with space before and after) exists in a line of a .txt file. if it does, its supposed to print out the line number(position isnt important). the problem is, its not finding the string. please help.</p>

<pre><code>int main() {
    string key (" hello ");
    ifstream myReadFile;
    myReadFile.open("test.txt");
    string s;
    int lineCount = 1;
    int found;
    if (myReadFile.is_open()) {
        while (!myReadFile.eof()) {
            getline(myReadFile, s);
            found = s.find(key);
            if(found != string::npos) {
                cout&lt;&lt;lineCount&lt;&lt;endl;
                lineCount++;
            }
         }
    }
    myReadFile.close();
    return 0;
}
</code></pre>
