Movatterモバイル変換


[0]ホーム

URL:


API Overview
Docs
API: easyAPI: multiAPI: shareAPI: URLAPI: WebSocketEnvironment varsErrorsExamplesSecuritySymbolsTutorial
easy setopt optionseasy getinfo optionsmulti setopt optionsTLS options
Functions
All functionscurl_easy_getinfocurl_easy_initcurl_easy_performcurl_easy_resetcurl_easy_setoptcurl_multi_add_handlecurl_multi_initcurl_multi_performcurl_multi_remove_handlecurl_multi_setopt
curl /libcurl /API /Examples /anyauthput.c

anyauthput.c

Related:
All functions
File a bug
Symbols
View in git
View raw
#### # # # #  _stat# #  _fstat#  _fileno# #  < 0x070c03##  ( *userp, curl_off_t offset, origin){  FILE *fp = (FILE *) userp; (-1 == fseek(fp, () offset, origin)) CURL_SEEKFUNC_CANTSEEK;  CURL_SEEKFUNC_OK; size_t( *ptr, size_t size, size_t nmemb, *stream){  size_t nread;   nread = fread(ptr, size, nmemb, stream); (nread > 0) {    fprintf(stderr,, ()nread);  }  nread;} ( argc, **argv){  CURL *curl;  CURLcode res;  FILE *fp; stat file_info;  *file; *url; (argc < 3) 1;   file = argv[1];  url = argv[2];   fp = fopen(file,);(!fp) 2; #   stat(file, &file_info);#  fstat(fileno(fp), &file_info);# curl_global_init(CURL_GLOBAL_ALL);   curl =curl_easy_init();(curl) {curl_easy_setopt(curl,CURLOPT_READFUNCTION, read_callback); curl_easy_setopt(curl,CURLOPT_READDATA, ( *) fp); curl_easy_setopt(curl,CURLOPT_SEEKFUNCTION, my_seek); curl_easy_setopt(curl,CURLOPT_SEEKDATA, ( *) fp); curl_easy_setopt(curl,CURLOPT_UPLOAD, 1L); curl_easy_setopt(curl,CURLOPT_URL, url); curl_easy_setopt(curl,CURLOPT_INFILESIZE_LARGE,                     (curl_off_t)file_info.st_size); curl_easy_setopt(curl,CURLOPT_HTTPAUTH, ()CURLAUTH_ANY); curl_easy_setopt(curl,CURLOPT_USERPWD,);     res =curl_easy_perform(curl);(res != CURLE_OK)      fprintf(stderr,,curl_easy_strerror(res)); curl_easy_cleanup(curl);  }  fclose(fp); curl_global_cleanup(); 0;}

Notice

This source code example issimplified and ignores returncodes and error checks to a large extent. We do this to highlight the libcurlfunction calls and related options and reduce unrelated code.

A real-world application will of course properly check every return value andexit correctly at the first serious error.


[8]ページ先頭

©2009-2025 Movatter.jp