URL Variable passing into Curl

后端 未结 1 1802
南旧
南旧 2021-01-16 00:49

I\'m new to cURL and needed it for my assignment. And I\'m using C++ for this.

I have this particular line which works fine.

curl_easy_setopt(curl, C         


        
相关标签:
1条回答
  • 2021-01-16 01:28

    CURLOPT_URL: Pass in a pointer to the actual URL to deal with. The parameter should be a char * to a zero terminated string...

    If you hold the URL in a std::string variable you should use std::string::c_str().

    std::string URL = "http://www.google.com";  
    curl_easy_setopt(curl, CURLOPT_URL, URL.c_str());
    
    0 讨论(0)
提交回复
热议问题