我有 curl_slist_append 的问题。代码 :
int my1 = rand() % 100;
int my2 = system ("dir");
int my3= time(NULL);
headers = curl_slist_append(headers,my1);
headers = curl_slist_append(headers,my2);
headers = curl_slist_append(headers,my3);
warning: passing argument 2 of ‘curl_slist_append’ makes pointer from integer without a cast
note: expected ‘const char *’ but argument is of type ‘int’
我解决了这个问题。Wireshark 测试一切正常。
int my1 = time(NULL);
char str[15];
sprintf(str, "%d", my1);
headers = curl_slist_append(headers,str);