title: Bug in opening a file with std::ifstream in C++ (half works)
body: <p>Sorry to bother you! Right now I'm having a "bug" in my game right now and if someone could point out what I'm doing wrong it would be very helpful. What is happening is when I run my code through Xcode the TileMap loads the file fine.</p>
  
  <p>However when I get the executable generated, copy and paste it into a different place, and then paste all the needed data files into the folder (.png files, .txt files), the game works fine except for the fact that the tilemap won't load.</p>
  
  <p>I'm not sure if this bug is due to the file locations changing when I run it in IDE and in stand alone.</p>
  
  <p>Images: (Sorry I don't have enough reputation so here's links)</p>
  
  <p>Game working run from Xcode: <img src="https://i.stack.imgur.com/Ong4Y.png" alt="enter image description here">
  Game not run from Xcode: <img src="https://i.stack.imgur.com/yN9JH.png" alt="enter image description here"></p>
  
  <p>This is the part of the code in TileMap.cpp that deals with loading the data from a text file into an array (just to show you it works):</p>
  
  <pre><code>int t_map[20][15] {};
  
  TileMap::TileMap(std::string fileName, std::string picFile)
  {
      std::ifstream inFS;
      inFS.open(fileName.c_str());
      if(!(inFS.is_open()))
      {
          std::cout &lt;&lt; "Could not open file.\n";
          return;
      }
  
      //controlls row
      int tt = 0;
  
      while(!inFS.eof())
      {
          char buff[100];
  
          //move to buffer thing
          inFS.getline(buff, 100);
  
          const char * token[20] = {};
          int j = 0;
  
          token[0] = strtok(buff, ",");
  
          if(token[0])
          {
              for(j=1;j&lt;COLMAX;j++)
              {
                  token[j] = strtok(0, ",");
                  if(!token[j])
                      break;
              }
          }
  
          for(int i=0;i&lt;COLMAX;i++)
          {
              t_map[i][tt] = atoi(token[i]);
          }
          tt++;
      }
  
      inFS.close();
      //ends the loading the file and starts the image stuff
      TextureManager::Instance()-&gt;load(picFile, "tileMap", Game::Instance()-&gt;getRenderer());
  }
  </code></pre>
  
  <p>Contents of text file I pass:</p>
  
  <pre><code>2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
  4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3
  4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3
  4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3
  4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3
  4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3
  4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3
  4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3
  4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3
  4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3
  4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3
  4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,3,3,3,3
  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
  2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2
  </code></pre>
  
  <p>Thank you very much for reading and helping.</p>