title: C/C++ Is there any cross plataform way of using relative paths?
body: <p>I'm programming a little game in SDL and the files are structured like this:</p>
  
  <p>"src/game/" have both .h and .cpp source files.</p>
  
  <p>"data/" have the game files like maps, tilesets, sprites and so on...</p>
  
  <p>to load a sprite for example I would use the following code.</p>
  
  <pre><code>spriteLib.loadSprite("data/sprites/sprite-ghost.bmp");
  </code></pre>
  
  <p>to convert this string to an absolute path I have those lines in the first 4 lines of the function:</p>
  
  <pre><code>SSprite CSpriteLib::loadSprite(std::string file)
  {
      //Converting the file path
      char converted[128];
      realpath(file.c_str(),converted);
      file = converted;
  </code></pre>
  
  <p>But this way the program only compiles under liux so... if anyone knows another way to do that I would be grateful.</p>