Simple question: Why does the string library function std::string::find always return std::string::npos?
<p>Please see the code fragment below, specifically the first 'else if' statement.  I want the user to have the ability to do this:</p>

<p>load filename</p>

<p>so I want to check that "load " is in the string and attempt to open whatever is after "load ".  However, string::npos seems to always be returned (string::npos just means there is no position).</p>

<p>I'm probably doing something stupid - this is basic stuff! </p>

<pre><code>void Main::user_choice() {
    string choice;
    while(choice != "exit") {
        cout &lt;&lt; "&gt; ";
        cin &gt;&gt; choice;
        if(choice == "view") {
            Main::view_frameworks();
        }
        else if(choice.find("load ") != string::npos) {

        }
        else if(choice == "exit") {
            return;
        }
        else {
            cout &lt;&lt; "Invalid command" &lt;&lt; endl;
        }
    }
}
</code></pre>
