title: Loading array from file
body: <p>I'm trying to load a file of integers, add them to a 2D array, iterate through the array, and add tiles to my level based on the integer(Tile ID)at the current index. My problem seems to be that the array is loaded/iterated through in the wrong order. This is the file I'm loading from:</p>
  
  <p>test.txt</p>
  
  <pre><code>02 02 02 02 02 02 02 02 02 02 02 02 02 02 02
  01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
  01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
  01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
  01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
  01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
  01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
  01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
  01 01 01 01 01 01 01 01 01 01 01 01 01 01 01
  </code></pre>
  
  <p>This is the level constructor:</p>
  
  <pre><code>Level::Level(std::string levelpath, int _width, int _height)
  {
      std::ifstream levelfile(levelpath);
      width = _width;
      height = _height;
      int ids[15][9];
  
      while (levelfile.is_open()) {
          std::copy_n(std::istream_iterator&lt;int&gt;(levelfile), width * height, &amp;ids[0][0]);
  
          for (int y = 0; y &lt; height; ++y) {
              for (int x = 0; x &lt; width; ++x) {
                  tiles.push_back(getTile(ids[x][y], sf::Vector2f(x * Tile::SIZE, y * Tile::SIZE)));
                  std::cout &lt;&lt; ids[x][y] &lt;&lt; " ";
              }
              std::cout &lt;&lt; std::endl;
          }
  
          levelfile.close();
      }
  }
  </code></pre>
  
  <p>And this is how I create the level:</p>
  
  <pre><code>level = std::unique_ptr&lt;Level&gt;(new Level("data/maps/test.txt", 15, 9));
  </code></pre>
  
  <p>Here's the output in the console:</p>
  
  <pre><code>2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
  2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
  2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
  2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
  2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
  2 2 1 1 1 1 1 1 1 1 1 1 1 1 1
  2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  2 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  </code></pre>
  
  <p>As you can see the contents are the same as in test.txt, but in the wrong order.</p>