title: Receiving segmentation fault when trying to read from file in dev c++ mingw 4.8.1
body: <p>I'm trying to read characters from file but i receive a segmentation fault when i have variables declared outside main. If i delete them and try to read from file, everything works smooth.
  I am using dev c++ 5.7.1 with mingw 4.8.1 the portable version.</p>
  
  <p>I've isolated the problem to just having a few variables declared and the file reading code. This piece of code comes from a bigger app that i am trying to develop(i am learning game development on my own).</p>
  
  <pre><code>#include &lt;iostream&gt;    
  #include &lt;fstream&gt;    
  bool running = true;  
  bool musicPlaying = true;  
  bool read = false;  
  int levelNumber;  
  int barWidth = 40;  
  int barHeight = 10;  
  float timeElapsed;  
  
  int main(int argc, char** argv) {    
      std::ifstream file;
      file.open("test.txt");
      std::cout&lt;&lt;file.is_open()&lt;&lt;std::endl;
      char c;
      while(!file.eof()){  
          file.get(c);  
          std::cout&lt;&lt;c;  
      }  
      return 0;  
  }
  </code></pre>
  
  <p>I get the output: 1, the file is open. But no character is read from file.
  <a href="https://i.stack.imgur.com/rfulx.jpg" rel="nofollow noreferrer">Debug information</a></p>
  
  <p>Why is this happening?</p>