获得cURL结果MFC C ++

时间:2014-09-27 06:46:01

标签: curl mfc

我正在尝试将cURL结果发送到消息框:

    CURL *curl;
CURLcode res;
curl = curl_easy_init();
if (curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
    curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
    res = curl_easy_perform(curl);
    if (res != CURLE_OK)
        fprintf(stderr, "curl_easy_perform() failed: %s\n",
        curl_easy_strerror(res));
    curl_easy_cleanup(curl);
}
MessageBox(res, _T("Title"), MB_ICONASTERISK | MB_OK);

我如何将消息框传递给res值?

1 个答案:

答案 0 :(得分:0)

        CString str(readBuffer.c_str());

    statictext.SetWindowTextW(LPCTSTR(str));
    MessageBox(LPCTSTR(str), _T("Title"), MB_ICONASTERISK | MB_OK);
    curl_easy_cleanup(curl);

终于找到了办法!