标题cmake的编译:先config,然后generate,最后打开工程
http服务器工具 :HFS
测试代码如下:
#include <iostream>
#include "curl/curl.h"
using namespace std;
#define CHECK_FORM_ERROR(x) \
if ((formCode = (x)) != CURL_FORMADD_OK) \
{
\
fprintf(stderr, "curl_formadd[%d] error.\n", formCode); \
goto out; \
}
#define CHECK_SETOPT_ERROR(x) \
if ((code = (x)) != CURLE_OK) \
{
\
fprintf(stderr, "curl_easy_setopt[%d] error.\n", code); \
goto all; \
}
int http_post_file(const char *url, const char *user, const char *pwd, const char *filename)
{
int ret = -1;
CURL *curl = NULL;
CURLcode code;
CURLFORMcode formCode;
int timeout = 15;
struct curl_httppost *post = NULL;
struct curl_httppost *last = NULL;
struct curl_slist *headerlist = NULL;
CHECK_FORM_ERROR(curl_formadd(&post, &last, CURLFORM_COPYNAME, "user",
CURLFORM_COPYCONTENTS, user,
CURLFORM_END));
CHECK_FORM_ERROR(curl_formadd(&post, &last, CURLFORM_COPYNAME, "password"