Access of file on desktop using C++
<p>I am using Windows 7   and I have created on the desktop a file named  <code>test.txt</code>.    How can I  access this  file using C++? For example,  consider following code:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;cstdlib&gt;
using namespace std;

int main(int argc, char *argv[])
{

  fstream inout("test.txt", ios::in | ios::out | ios::binary);

  if(!inout) {
    cout &lt;&lt; "Cannot open input file.\n";
    return 1;
  }

  long e, i, j;
  char c1, c2;
  e = 5;

  for(i=0, j=e; i&lt;j; i++, j--) {
    inout.seekg(i, ios::beg);
    inout.get(c1);
    inout.seekg(j, ios::beg);
    inout.get(c2);

    inout.seekp(i, ios::beg);
    inout.put(c2);
    inout.seekp(j, ios::beg);
    inout.put(c1);
  }

  inout.close();
  return 0;
}
</code></pre>

<p>In the fragment <code>fstream inout("test.txt", ios::in | ios::out | ios::binary)</code>, what should I change to access   my test.txt on desktop?</p>
