jeudi 19 novembre 2020

How to hide cmd windows while making curl requests

I am new to curl. I am trying to build new C++ project which makes http request to cloud server. For this I am using curl library libcurl(c version)/curlpp(c++ version). In both the libraries while calling perform() it is opening a new cmd window and closing immediately. is there any way to avoid flashing this new window ? I have to make server request at many places and if it flashes everytime , it will not look good. I am building this project in windows 10 using visual studio 2019.

libcurl:

    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, cb);
    /* Perform the request, res will get the return code */
    res = curl_easy_perform(curl);

curlpp:

   curlpp::Easy myRequest;
   myRequest.setOpt<Url>("https://example.com");
   myRequest.perform();

calling directly system():

   system("curl https://example.com");

the above all three are opening and closing cmd window which I don't want at all . Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire