cURL / Mailing Lists / curl-users / Single Mail

curl-users

Runing libcurl in Qt 4.8.4: No ouput result in console mode.

From: Olivier Austina <olivier.austina_at_gmail.com>
Date: Mon, 24 Jun 2013 16:46:45 +0200

Hi,
I am new to libcurl. I want to run some example from the libcurl site. Even
if I use C/C++ standard output function like std::cout or create a file to
see the result, it doesn't work. I have use the win23 version at this link
http://curl.haxx.se/dlwiz/?type=lib. I use Window XP. I use only this
package (no additional software is installed regard to this package) .
This is the code:

#include <stdio.h>

#include <C:/curlmingw32/include/curl/curl.h>

int main(void)

{

  CURL *curl;

  CURLcode res;

  FILE * pFile;

  pFile = fopen ("myfile.txt","w");

  /* http://curl.haxx.se/libcurl/c/curl_easy_init.html */

  curl = curl_easy_init();

  if(curl) {

    /* http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTURL */

    curl_easy_setopt(curl, CURLOPT_URL, "http://www.exemple.com");

    /* http://curl.haxx.se/libcurl/c/curl_easy_perform.html */

    res = curl_easy_perform(curl);

    if(CURLE_OK == res) {

      char *ct;

      /* ask for the content-type */

      /* http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html */

      res = curl_easy_getinfo(curl, CURLINFO_CONTENT_TYPE, &ct);

      if((CURLE_OK == res) && ct)

        printf("We received Content-Type: %s\n", ct);

    }

    /* always cleanup */

    /* http://curl.haxx.se/libcurl/c/curl_easy_cleanup.html */

    curl_easy_cleanup(curl);

  }

  return 0;

}

And the Qt .pro file:

#-------------------------------------------------## Project created
by QtCreator 2013-06-24T04:51:41##-------------------------------------------------
QT += core
QT -= gui
TARGET = OOOCONFIG += consoleCONFIG -= app_bundle#INCLUDEPATH
+=curlmingw32INCLUDEPATH
+=C:/curlmingw32DEPENDPATH="C:/curlmingw32/include"

win32:LIBS += c:\MinGW\lib\libcurldll.aTEMPLATE = app

SOURCES += main.cpp
HEADERS += \ C:/curlmingw32/include/curl/curl.h

Thanks.

Regards
Olivier

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-06-24