开发者

libcURL Post Confusion

I am trying to do a simple post using libcURL. I noticed that if I define my data as

char const data[] = "Some dat开发者_高级运维a";

It does not POST.

If I use char const *data = "Some data";

It does POST.

The main issue is [] vs *. Since an array is a pointer I don't understand why it won't post using the array style.

Any help is greatly appreciated.

Thanks, Greg


libcurl will POST the data you pass to it, with for example the CURLOPT_POSTFIELDS option. It does not distinguish between a char array and a pointer to data as long as you make sure you pass it on correctly.

A very simple post example can be found here: http://curl.haxx.se/libcurl/c/simplepost.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜