title: SFML (32-bit VS12) - Unhandled exception at 0x701ADEF8 (msvcr110.dll) in SFML.exe: 0xC0000005: Access violation reading location 0x0526. LoadFromFile
body: <p>The following code gives me the uncaught exception (specifically</p>
  
  <pre><code>txtr.loadFromFile("C:/Users/kidz/Documents/Visual Studio 2012/Projects/SFML/Debug/chessboard.gif");
  </code></pre>
  
  <p>): "Unhandled exception at 0x701ADEF8 (msvcr110.dll) in SFML.exe: 0xC0000005: Access violation reading location 0x05260000."</p>
  
  <pre><code>int _tmain(int argc, wchar_t* argv[]) {
      sf::RenderWindow window(sf::VideoMode(512, 512), "ChessPlusPlus", sf::Style::Close);
      sf::Sprite chessboard;
      sf::Texture txtr;
  
      txtr.loadFromFile("C:/Users/kidz/Documents/Visual Studio 2012/Projects/SFML/Debug/chessboard.gif");
      chessboard.setTexture(txtr);
  
      while (window.isOpen()) {
          sf::Event event;
          while (window.pollEvent(event)) {
              if (event.type == sf::Event::Closed) {
                  window.close();
              }
          }
  
          window.clear();
          window.draw(chessboard);
          window.display();
      }
  
      getwchar();
      return 0;
  }
  </code></pre>
  
  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Also, during the debugging of the program, a bunch of random ASCII characters get outputted onto the console (sometimes even personal files like essays, etc...). Then, the console goes blank (null characters) and the exception is thrown.</p>
  
  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Once, I was able to pause the program and scroll all the way up at it said something like: "Unable to open file 'chessboard.gif (with some random ASCII characters in the word)'" and then the long list of ASCII characters.</p>
  
  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Is there something wrong with SFML or am I doing something wrong? I know that SFML docs say that sometimes the file may not load and throw a exception, but in this case, it's going crazy. Also, I have randomly put a filename that does not exist and the same thing still occurred instead of throwing a file not found exception.</p>
  
  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I have tried the same code on Orwell Dev-C++ and it just returns a white box where the image is supposed to be and returns an exception when the file does not exist.</p>
  
  <p>Some pictures:<br>
  <a href="http://i.stack.imgur.com/gq420.png" rel="nofollow">http://i.stack.imgur.com/gq420.png</a><br>
  <a href="http://i.stack.imgur.com/Os8jw.png" rel="nofollow">http://i.stack.imgur.com/Os8jw.png</a></p>
  
  <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I will be glad to provide any extra information.</p>
  
  <p>Thank you,<br>
  &nbsp;&nbsp;Usandfriends!</p>