title: Failed writing received data to disk/application on libcurl
body: <p>I'm using VC++ 2015 (v140) with QT MSVC 2015. My project is 32-bit(x86) and libcurl is compiled as is, I mean I just downloaded from official website and compiled it, no OpenSSL or other fancy extensions were added.</p>
  
  <p>The code I'm trying to run is here:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;curl/curl.h&gt;
  #include &lt;curl/easy.h&gt;
  #include &lt;string&gt;
  
  class Essentials {
  private:
      CURL *curl;
      CURLcode res;
  
  public:
      std::string SSLInternetConnection(char* url) {
          curl = curl_easy_init();
          if (curl) {
              curl_easy_setopt(curl, CURLOPT_URL, "http://google.com");
              curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, true);
              curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false);
              res = curl_easy_perform(curl);
              curl_easy_cleanup(curl);
              if (res == CURLE_OK) {
                  return "CONNECTED";
              }
              else {
                  fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
                  return curl_easy_strerror(res);
              }
          }
      }
  };
  </code></pre>
  
  <p>I'm calling it from a function that creates a dialog, and I'm writing the result to the label in the dialog.</p>
  
  <pre><code>#include &lt;QtWidgets/QDialog&gt;
  #include &lt;QtWidgets/QMessageBox&gt;
  #include &lt;QtWidgets/QSpacerItem&gt;
  #include &lt;QtWidgets/QGridLayout&gt;
  #include &lt;QtWidgets/QLabel&gt;
  #include &lt;DH_loginView.h&gt;
  #include &lt;chrono&gt;
  #include &lt;thread&gt;
  #include "Essentials.cpp"
  
  class Dialogs {
      public:
          void loginDialog(const QString uname, QMainWindow *a) { // this function is where I'm calling the curl lib.
              Ui::loginView loginViewer;
              loginViewer.setupUi(a);
              Essentials e;
              std::string asd = e.SSLInternetConnection("http://google.com/");
              QString aaa = QString::fromStdString(asd);
              loginViewer.label-&gt;setText(aaa);
              //QString utf8Dialog = uname + QStringLiteral(" kullanıcısı giriş yapıyor");
              a-&gt;setWindowTitle(aaa);
          }
          void loginErr1() {
              QMessageBox mbox;
              QSpacerItem* horizontalSpacer = new QSpacerItem(500, 0, QSizePolicy::Minimum, QSizePolicy::Expanding);
              mbox.setWindowTitle("HATA");
              QGridLayout* layout = (QGridLayout*)mbox.layout();
              layout-&gt;addItem(horizontalSpacer, layout-&gt;rowCount(), 0, 1, layout-&gt;columnCount());
              mbox.setText(QStringLiteral("Kullanıcı adı ve şifre boş olamaz!"));
              mbox.exec();
          }
  };
  </code></pre>
  
  <p>And the issue is, <a href="http://google.com" rel="nofollow noreferrer">http://google.com</a> is reachable on every app on my PC. However, I used to have "Couldn''t resolve hostname" error for a while, and when I turned on my PC today, it was throwing a different error.  I have no idea why is this happening, because I'm working with curl on php for years and I acknowledge that this issue is out of my knowledge, since I'm newbie on C++.</p>
  
  <p><a href="https://i.stack.imgur.com/1C5QT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1C5QT.png" alt="err"></a></p>
  
  <p>Thank you for your help!</p>