How do I write to a file in another directory using ofstream?
<p>I'm working on a project in C++.</p>

<p>In my current directory there is another folder, called game_files, and inside of game_files there is a file named player_name.txt </p>

<p>In my cpp file (Kingdom.cpp) I have the code below </p>

<pre><code>std::string playerName; 
std::cin &gt;&gt; playerName;
std::ofstream nameFile;
nameFile.open("/game_files/player_name.txt")
nameFile &lt;&lt; playerName;
nameFile.close();
</code></pre>

<p>Yet when I check the file, nothing has been written to it!
I have been searching for answers for a while and am completely lost.</p>

<p>Any and all help is appreciated, thanks! </p>