title: Getting verbose information from libcurl to a file
body: <p>I am trying to develop a QT Application in C/C++ which uses libcurl. Simply, i want to save VERBOSE data to a file. In libcurl API documentation, it is said that (<a href="https://curl.haxx.se/libcurl/c/CURLOPT_VERBOSE.html" rel="nofollow">https://curl.haxx.se/libcurl/c/CURLOPT_VERBOSE.html</a>)</p>
  
  <blockquote>
    <p>The verbose information will be sent to stderr, or the stream set with CURLOPT_STDERR.</p>
  </blockquote>
  
  <p>So, VERBOSE information will be at stderr. And after i followed the link for CURLOPT_STDERR (<a href="https://curl.haxx.se/libcurl/c/CURLOPT_STDERR.html" rel="nofollow">https://curl.haxx.se/libcurl/c/CURLOPT_STDERR.html</a>) which tells,</p>
  
  <blockquote>
    <p>Pass a FILE * as parameter. Tell libcurl to use this stream instead of stderr when showing the progress meter and displaying CURLOPT_VERBOSE data. </p>
  </blockquote>
  
  <p>At the CURLOPT_STDERR link, there exists a code sample. I've tried it on my own application as:</p>
  
  <pre><code>CURL *curl = curl_easy_init();
  FILE *filep = fopen("dump.txt", "wb");
  if (curl) {
      curl_easy_setopt(curl, CURLOPT_URL, "https://www.google.com");
      curl_easy_setopt(curl, CURLOPT_STDERR, filep);
      curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
  
      curl_easy_perform(curl);
  }
  CURLcode res = curl_easy_perform(curl);
  
  
  if (CURLE_OK != res) {      
      fprintf(stderr, "curl told us %d\n", res);
  }
  curl_easy_cleanup(curl);
  fclose(filep);
  </code></pre>
  
  <p>However, verbose information isn't shown at command line and the file which is created for the verbose information is empty. How can i solve this problem?</p>