title: how to back to the first of text file
body: <p>i have a txt file which have some lines ...and my code is :</p>
  
  <pre><code>string line;
  ifstream myfile("c:\\main.txt");
  
  bool passport = true;
  
  while(passport==true){
  
      int pos1=0;
      cout&lt;&lt;setw(20)&lt;&lt;"PassPort_Number : ";
      cin&gt;&gt;add.Id ;
      if (myfile.is_open())
      {
          while(!myfile.eof()){
              getline(myfile,line);
              pos1+=line.find(add.Id);
              cout&lt;&lt;pos1;
          }
      }
  
      if(pos1&lt;0)
          passport=false;
      else {
          cout&lt;&lt;"PassPort Number tekrariye :d"&lt;&lt;endl;
      }
  }
  </code></pre>
  
  <p>first time everything is ok but at the second time of running it doesn't enter to second while (while(!myfile.eof() ) ...
  what's wrong with my code?</p>
  
  <p>when it goes to the end of text file it doesn't back to the first of file at the next loop ... how can i back to the first of text file ?</p>