title: How to open a file with relative path in C++?
body: <p>I am writing test cases right now and I created some test files which I try to read. The absolute path is:</p>
  
  <pre><code>/home/user/code/Project/source/Project/components/Project/test/file.dat
  </code></pre>
  
  <p>but testing with an absolute path is bad for obvious reasons. So I try to convert the absolute path into a relative one and I don't know why it doesn't work. I created a file with the relative path </p>
  
  <pre><code>findme.dat
  </code></pre>
  
  <p>and I found it in </p>
  
  <pre><code>/home/user/code/Project/build/source/Project/components/Project/test/findme.dat
  </code></pre>
  
  <p>so I created the relative path</p>
  
  <pre><code>/../../../../../../source/Project/components/Project/test/file.dat
  </code></pre>
  
  <p>but the file is not open and not associated with the <code>is</code> object,
  <code>std::ifstream is (path);</code>, and the <code>is.is_open()</code> function returns fulse.</p>
  
  <p>Can you help me?</p>