私は現在、MacOSでC++プログラムを作成しています.HWIDとIPアドレスの2つの変数を取って、そう;C++で事前定義された変数を使用してcURL GETリクエストを作成する
CURL* curl;
string result;
curl = curl_easy_init();
curl_easy_setopt(curl, CURLOPT_URL, "website.com/c.php?ip=" + ip + "&hwid=" + hwid);
これはhwid
とip
が定義されている方法です。
auto hwid = al.exec("ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { print $3; }'");
auto ip = al.exec("dig +short myip.opendns.com @resolver1.opendns.com.");
al.execは、ターミナルコマンドの出力を実行して返す関数です。
しかし、これをすべて行う問題は、私はcurl_easy_setoptにparamsのタイプが間違っているのですか?前の例のようにGETリクエストを作成するときにこれらのエラーが発生しています。
Cannot pass object of non-trivial type 'basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >' through variadic function; call will abort at runtime
ご協力いただければ幸いです。
ありがとうございます!多くの助けを借りて – siroot