title: Strange ifstream access violation under Visual Studio 2012
body: <p>I have this piece of code working on Linux with g++:</p>
  
  <pre><code>GLuint Shader::initShader_(GLenum shaderType, const std::string&amp; shaderFilename)
  {
      std::ifstream inputFile(shaderFilename.c_str());
      if (inputFile.is_open() == false)
      {
          std::ostringstream oss;
          oss &lt;&lt; "Shader " &lt;&lt; shaderFilename &lt;&lt; " doesn't exist!";
          print(LOG_LEVEL::ERROR, oss.str());
      }
      ...
  }
  </code></pre>
  
  <p>where the three dots represent some code. On both g++ and Visual Studio (2012) the code compiles. But with Visual Studio, the first line throws an access violation exception. This actually happens when opening the file, and the debugger redirects me to <i>do_always_noconv</i> but I do not understand the problem. </p>
  
  <p>The string containing the filename is valid and the file the program is trying to open is in the good directory, and the debugger works in this directory. I guess the problem does not come from the file itself, because if the stream cannot open it then I could still enter the next line without an access violation.</p>
  
  <p>Does anyone already encountered this problem or has an idea? Again it worked without any problem on Linux with g++.</p>
  
  <p>Thanks for your help.</p>