title: URLDownloadToFile issues
body: <p>Okay, so I have been trying to do some simple stuff like downloading and transferring files in Visual C++, and I had been using the <code>URLDownloadToFile()</code> function. The code compiled, and it didn't give any errors, however it would not download anything. Obviously, I didn't just run over here the minute my code doesn't work, so I did some debugging and such, which I will mention in a minute. Here's the code. </p>
  
  <pre><code>#pragma comment(lib, "urlmon.lib")
  
  #include &lt;Windows.h&gt;
  #include &lt;urlmon.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;tchar.h&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  void dwfile();
  
  int main() {
      dwfile();
      return 0;
  }
  
  int dwfile() {
      string url("http://0.0.0.0/putty.exe"); // I changed the IP for privacy 
      string file("C:\\Putty");
  
      const char *strUrl = url.c_str(); 
      const char *strFile = file.c_str(); // I had been testing with these, not currently using them
  
      HRESULT hr = URLDownloadToFile(NULL, url.c_str(), file.c_str(), 0, NULL);
  
      if (FAILED(hr)) {
          printf("failed\n");
          OutputDebugString("\n");
          OutputDebugString("FAILED\n");
          OutputDebugString("\n");
          GetLastError();
          system("pause");
      }
  }
  </code></pre>
  
  <p>Keep in mind that I am not a professional, and that I am not incredibly experienced in C++. I read a few books, but I am on the younger side, and I am currently doing this for fun. </p>
  
  <p>As for debugging, <code>url</code> and <code>file</code> would throw errors when called in the <code>URlDownloadToFunction</code> until I did <code>.c_str()</code> and converted them. I set a break point at the function call, and noticed that the variable hr had the value of 0xcccccccc, until the next break point, at the <code>printf</code> statement, when <code>hr</code> then had the value of <code>E_ABORT Operation Aborted</code> and nothing else. There didn't seem to be an issue with the strings, but it didn't tell me anything else. I'm honestly just stumped. Any and all help is appreciated greatly.</p>
  
  <p><strong>EDIT</strong> </p>
  
  <p>I feel like an idiot, but I was trying to write to the root of my C:\ drive, even though I had forgot to enable UAC. When I enabled it, it downloaded and ran Putty just fine, although I'm considering changing from URLDownloadToFile() to using WinInet. Thanks for all the help!</p>