Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C++ (http://www.go4expert.com/forums/cpp/)
-   -   Dynamically load url in libcurl with C++ (http://www.go4expert.com/forums/dynamically-load-url-libcurl-cpp-t13798/)

thekevin07 13Sep2008 11:12

Dynamically load url in libcurl with C++
 
I am eventually going to call url dynamically from mysql but below is pretty close what i'm trying to do before i plug mysql into my program. The error that gets returned is error code 3
which i believe means the url was formatted poorly anyone know what im doing wrong

Code:

       
string x="http://www.mysite.com/";
    curl = curl_easy_init(); 
          curl_easy_setopt(curl, CURLOPT_URL, x);


Thanks

xpi0t0s 14Sep2008 15:20

Re: Dynamically load url in libcurl with C++
 
Not RTFM is what you're doing wrong.

CURLOPT_URL
The actual URL to deal with. The parameter should be a char * to a zero terminated string.

A string is NOT a char * to a zero terminated string. However, x.c_str() is, so that would be the solution.

thekevin07 15Sep2008 06:37

Re: Dynamically load url in libcurl with C++
 
sorry i did read the manual but im kind of new still i took a c++ course in high school a while back im not use to .c_str() type stuff all the work we did dealt with numbers.

Thank you very much for the help.


All times are GMT +5.5. The time now is 21:16.