URL-Variable, die in Curl übergeht

Ich bin neu in CURL und brauchte es für meine Aufgabe. Und dafür benutze ich C ++.

Ich habe diese bestimmte Linie, die gut funktioniert.

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

Mein Problem tritt jedoch auf, wenn ich die URL in eine Variable ändere. d.h.

string URL = "http://www.google.com";  
curl_easy_setopt(curl, CURLOPT_URL, URL);

Mein Programm stürzt ab. Jeder kann mir zeigen, was meine Fehler sind?

Antworten auf die Frage(1)

Ihre Antwort auf die Frage