title: c++ - reading characters from ifstream
body: <p>I'm trying to read characters from a file and I get stuck in an infinite loop, this is the code :</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  
  using namespace std;
  
  int _tmain(int argc, _TCHAR* argv[])
  {
      ifstream ifs("ifile.txt", ios_base::in);
      int b;
      while ((b = ifs.get()) != EOF)
      {
          cout &lt;&lt; b &lt;&lt; endl;
      }
  }
  </code></pre>
  
  <p>Note that I've made a file called ifile.txt inside the project Debug folder where the .exe file is being created (I'm using Microsoft visual studio 2013)</p>
  
  <p>when I run it, it get stuck in an infinite loop.
  Not sure why it happens but I think it might have to be with the place I've created the ifile.txt maybe ?</p>