Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

curl c api

 curl c api
¹ØÓÚCurlµÄ½éÉܺܶ࣬ÕâÀï²»Ïêϸ½éÉÜ£¬Ö÷Ҫ̸һϼòµ¥Ó¦Óá£
×î½üÑо¿ÁËÒ»ÏÂLinuxϵÄcurl C API,curl c APIµÄÎĵµ±È½Ï·á¸»£¬Î¨Ò»¾ÍÊDzéÕÒÆðÀ´£¬·ÑЩʱ¼ä¡£CurlµÄC APIºÍcurlµÄPHP API£¬º¯Êý½Ó¿ÚºÍ×÷ÓôóÖÂÏàͬ£¬ËùÒÔÈç¹ûÓÐPHP APIʹÓþ­ÑéÓ¦¸ÃºÜºÃÀí½â¡£
1£ºCURLcode curl_global_init(long flags);º¯Êý£¬Õâ¸öº¯ÊýÈ«¾ÖÐèÒªµ÷ÓÃÒ»´Î£¨¶à´Îµ÷ÓÃÒ²¿ÉÒÔ£¬²»¹ýûÓбØÒª£©£¬ ËùÒÔÕâÒ²ÊǰÑCurlplusÉè¼Æ³Éµ¥ÌåÀàµÄÔ­Òò£¬curl_global_initº¯ÊýÔÚÆäËûlibcurlº¯Êýµ÷ÓÃǰÖÁÉÙµ÷ÓÃÒ»´Î£¬³ÌÐò×îºóÐèÒªµ÷ÓÃcurl_global_cleanup,½øÐÐÇåÀí¡£
²ÎÊý£ºflags 
CURL_GLOBAL_ALL Initialize everything possible. This sets all known bits.
CURL_GLOBAL_SSL Initialize SSL
CURL_GLOBAL_WIN32 Initialize the Win32 socket libraries.
CURL_GLOBAL_NOTHING Initialise nothing extra. This sets no bit.
CURLcode ÊÇÒ»¸öenum£¬µ±CURLcodeΪCURLE_OKʱ£¬±íʾº¯ÊýÖ´Ðгɹ¦£¬·ñÔòʧ°Ü£¬¾ßÌå´íÎóÔ­Òò¿ÉÒԲ鿴<curl/curl.h>ÎļþÄڵ͍Òå¡£
2£ºcurl_easy_init - Start a libcurl easy session
curl_easy_initÓÃÀ´³õʼ»¯Ò»¸öCURLµÄÖ¸Õë(ÓÐЩÏñ·µ»ØFILEÀàÐ͵ÄÖ¸ÕëÒ»Ñù). ÏàÓ¦µÄÔÚµ÷ÓýáÊøÊ±ÒªÓÃcurl_easy_cleanupº¯ÊýÇåÀí. Ò»°ãcurl_easy_initÒâζ×ÅÒ»¸ö»á»°µÄ¿ªÊ¼. ËüµÄ·µ»ØÖµÊÇCURL *£¬curl_easy_initº¯ÊýÊÇÏß³ÌÏà¹ØµÄ£¬Ò²¾ÍÊÇ˵²»ÄÜÔÚÒ»¸öÏß³ÌÖе÷ÓÃÁíÍâÒ»¸öÏß³Ìͨ¹ýcurl_easy_init´´½¨µÄCURLÖ¸Õë¡£
3£ºCURLcode curl_easy_setopt(CURL *handle, CURLoption option, parameter); 
ÃèÊö: Õâ¸öº¯Êý×îÖØÒªÁË.¼¸ºõËùÓеÄcurl ³ÌÐò¶¼ÒªÆµ·±µÄʹÓÃËü.Ëü¸æËßcurl¿â.³ÌÐò½«ÓÐÈçºÎµÄÐÐΪ. ±ÈÈçÒª²é¿´Ò»¸öÍøÒ³µÄhtml´úÂëµÈ.£¬ÒªÏë¾ßÌåÁ˽âCURLµÄÐÐΪ£¬±ØÐë¶ÔCURLoptionÓÐ×ã¹»µÄÁ˽⣬¾ßÌå¿ÉÒԲο¼
http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
ÕâÀïÓÐÁ½¸öÀàÐͲ»Ò×Àí½âCURLOPT_WRITEFUNCTION£¬CURLOPT_WRITEDATA
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, Curlplus::writer);
ÉèÖÃÒ»¸ö»Øµ÷º¯Êý£¬Õâ¸ö»Øµ÷º¯ÊýµÄ¸ñʽÊÇ
size_t function( void *ptr, size_t size, size_t nmemb, void *stream);
ptr,·µ»ØÊý¾ÝµÄÖ¸Õë
size,·µ»ØÊý¾Ýÿ¿éµÄ´óС
nmemb,·µ»ØÊý¾ÝµÄ¿éÊý£¨ÕâÀï·µ»ØÊý¾Ý´®µÄÕæÕý´óСΪsize*nmemb£©
stream£¬ÊÇcurl_easy_setopt(curl, CURLOPT_WRITEDATA, &buffer); ÖеÄbufferµÄÖ¸Õë¡£
ÔÚÉÏÃæµÄÀý×ÓÖУ¬b


Ïà¹ØÎĵµ£º

LinuxÏÂc³ÌÐò¿ª·¢±Ê¼Ç

 µÚÒ»ÕÂ
1.
½âÊÍÐÔÓïÑÔ£ºshell  javascript python  ±à³ÌÈËÔ±²»ÐèÒª¾­¹ý±àÒë Á¬½ÓµÄ¹ý³Ì£¬¿ÉÒÔÔÚÌØ¶¨»·¾³ÏÂÖ±½ÓÖ´ÐеÄÓïÑÔ  ×Ô¶¯±àÒëÁ¬½Ó¡£¿ª·¢Ð§Âʸߣ¬µ«ÔËÐÐЧÂʵ͡£
±àÒëÐÍÓïÑÔ£ºjava c c++£¬ÐèÒª¾­¹ý±à³ÌÈËÔ±¾­¹ý±àÒëºÍÁ¬½Ó²úÉú¿ÉÖ´ÐгÌÐòµÄÓïÑÔ¡£ÔËÐÐЧÂʸߡ£
2.
Êý¾Ý
Êý¾Ý½á¹¹£ºÊý¾ÝÖ®¼äµÄ ......

C/C++ ´ò¿ªPDFÎĵµ

 wchar_t wsWorkingDir[256] = _T("");
 CString strPDF(_T(""));
 ::GetCurrentDirectory(256, wsWorkingDir);
 strPDF.Format(_T("%s"), wsWorkingDir);
 if (strPDF.GetAt(strPDF.GetLength()-1) != '\\')
 {
  strPDF += '\\';
 }
 strPDF += "doc\\my.pdf" ......

CÌâÄ¿3

1. ÓÃÔ¤´¦ÀíÖ¸Áî#define ÉùÃ÷Ò»¸ö³£Êý£¬ÓÃÒÔ±íÃ÷1ÄêÖÐÓжàÉÙÃ루ºöÂÔÈòÄêÎÊÌ⣩
#define SECONDS_PER_YEAR   (60 * 60 * 24 * 365)UL
ÎÒÔÚÕâÏë¿´µ½¼¸¼þÊÂÇ飺
     1). #define Óï·¨µÄ»ù±¾ÖªÊ¶£¨ÀýÈ磺²»ÄÜÒԷֺŽáÊø£¬À¨ºÅµÄʹÓ㬵ȵȣ©
     2). ¶®µÃÔ¤´¦ÀíÆ÷½«Î ......

C/C++/VC++ ±äÁ¿ÃüÃû¹æÔò

C/C++/VC++ ±äÁ¿ÃüÃû¹æÔò
ÊÇVC++µÄô£¿
4.±äÁ¿·ç¸ñ
±äÁ¿¾¡Á¿²ÉÓÃÐÙÑÀÀûÃüÃû·¨£¬Í¬Ê±½áºÏVCµÄÔ­Ôò£»Ò»°ãÇé¿öÏ£¬±äÁ¿µÄÈ¡Ãû·½Ê½Îª£º
<scope><prefix><qualifier>
ÓйØÏîÄ¿µÄÈ«¾Ö±äÁ¿±ØÐëÓÃg_¿ªÊ¼£¬Àà³ÉÔ±±äÁ¿ÓÃm_£¬¾Ö²¿±äÁ¿Èôº¯Êý½Ï´óÔò¿É¿¼ÂÇÓÃl_ÓÃÒÔÏÔʾ˵Ã÷ÆäÊǾֲ¿±äÁ¿¡£
ǰ׺
ÀàÐÍ
ʾÀý
g_ ......

CÓïÑÔÁ¬½ÓmysqlÊý¾Ý¿â£¬¶ÁÈ¡mysqlÄÚÈÝ

 //linuxϱàÒëg++ $(mysql_config --cflags)  ***.cpp  $(mysql_config --libs)
/*mysqlÊý¾Ý¿âÖбíµÄÄÚÈÝ
mysql> select * from maindb;
+------------------+---------+-------------+---------+----------+---------------------+---------------------+---------------------+------------------- ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ