title: How to get the absolute path of the desktop for the calling user on Windows
body: <p>How can I get the absolute path to the desktop for the user that is starting my program?</p>
  
  <pre><code>int main () {
    ofstream myfile;
    myfile.open ("C:\\Users\\username\\Desktop\\example.txt");
    myfile &lt;&lt; "Writing this to a file" &lt;&lt; endl;
    myfile.close();
  }
  </code></pre>