title: std::find : finding exact string c++ in a file
body: <p>i want to use std::find() to see if an id exists in a file, example:</p>
  
  <pre><code>    //file:
      2467
      435
      24667
  </code></pre>
  
  <p>here is the function:</p>
  
  <pre><code>bool idInFile(string argId)
  {
  
      std::ifstream anchorFile("anchors");
      string line;
      if(!anchorFile )//file not opened or empty
      {
          //cout &lt;&lt; "file cannot be opened" &lt;&lt; endl;
          return false;
      }
      anchorFile.seekg(0, ios::end);
      if(anchorFile.tellg() == 0)
      {
          //cout &lt;&lt; "file is empty" &lt;&lt; endl;
          return false;
      }
      anchorFile.seekg(0, ios::beg);
      while(getline(anchorFile, line))
      {
              std::size_t found = line.find(argId);
              if (found!=std::string::npos)
                      return true;
      }
  
  
      return false;
  }
  </code></pre>
  
  <p>int this case: if i try to search the id 246, the function returns true because of the "2467" that contains "246", i need it to return true if only the id "246" exist in a line.</p>