38 r = sscanf(ptr,
"Content-Length: %ld\n", &len);
40 *((
long *) stream) =
len;
68 static int upload(
CURL *curlhandle,
const char *remotepath,
69 const char *localpath,
long timeout,
long tries)
72 long uploaded_len = 0;
76 f = fopen(localpath,
"rb");
103 for(c = 0; (r !=
CURLE_OK) && (c < tries); c++) {
126 fseek(f, uploaded_len, SEEK_SET);
149 CURL *curlhandle = NULL;
154 upload(curlhandle,
"ftp://user:pass@example.com/path/file",
"C:\\file",
UNITTEST_START char * ptr
static size_t discardfunc(void *ptr, size_t size, size_t nmemb, void *stream)
static size_t getcontentlengthfunc(void *ptr, size_t size, size_t nmemb, void *stream)
#define curl_easy_setopt(handle, option, value)
static int upload(CURL *curlhandle, const char *remotepath, const char *localpath, long timeout, long tries)
CURL_EXTERN CURL * curl_easy_init(void)
CURL_EXTERN void curl_easy_cleanup(CURL *curl)
#define CURL_READFUNC_ABORT
CURL_EXTERN CURLcode curl_global_init(long flags)
curl_global_init() globally initializes curl given a bitwise set of the different features of what to...
CURL_EXTERN void curl_global_cleanup(void)
curl_global_cleanup() globally cleanups curl, uses the value of "init_flags" to determine what needs ...
static size_t readfunc(void *ptr, size_t size, size_t nmemb, void *stream)
CURL_EXTERN const char * curl_easy_strerror(CURLcode)
CURL_EXTERN CURLcode curl_easy_perform(CURL *curl)