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

memcachde Óë c/c++ Ó¦ÓÃ

ÐÞ¸Ämakefile£¬ÔÚLIBSÀïÃæ¼ÓÉÏ-lmemcached£¬±ÈÈçÔ­À´ gcc test.c£¬ÏÖÔÚ gcc test.c -lmemcached¡£Õâ¸ö¿â¾ÍÊÇlibmemcachedÌṩµÄ¡£
È»ºóÌí¼Ó#include<libmemcached/memcached.h>£¬Õâ¸öÎļþÒ²ÊÇlibmemcachedÌṩµÄ¡£
Ö÷º¯ÊýÀïÃæÐèÒªÌí¼Ó£º
    memcached_st *memc;
    uint32_t  flags;
    memcached_return rc;
    memcached_server_st *servers;
    memc= memcached_create(NULL);
    servers= memcached_servers_parse("127.0.0.1:12300");
    memcached_server_push(memc, servers);
    memcached_server_list_free(servers);
    memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_BINARY_PROTOCOL, 0);
   
Õâ¾ÍÊdzõʼ»¯µÄÈ«²¿´úÂ룬¿ÉÒÔÉèÖúܶණÎ÷£¬²»¹ýÎÒÏÖÔÚÖ»ÒªÒ»¸ö·þÎñÆ÷£¬¾Í¿´Ò»¾ä»°£º
    servers= memcached_servers_parse("127.0.0.1:12300");
Õâ¾ÍÊÇÖ¸Ã÷ÒªÁ¬½Óµ½Î»ÓÚ127.0.0.1¼àÌý12300¶Ë¿ÚµÄmemcached³ÌÐò. ÆäËû¶¼²»¹Ü¡£
×îºóÓÃÒ»¶ÎÐ޸ĺóµÄ´úÂë½éÉÜÁ½¸öº¯Êý£¬memcached_getºÍmemcached_set£¬¶¼¿ÉÒÔman³öÀ´¡£
        char * result_str; /*Õâ¸ö¾ÍÊDzéѯµÄ½á¹û*/
        std::string query="Òª²éѯµÄÊý¾ÝÃû";
        result_str= memcached_get(memc, query.c_str(), strlen(query.c_str()),
                &result_str_length, &flags, &rc);
        if (rc == MEMCACHED_SUCCESS)
        {
            printf("%s",result_str);
            free(result_str); /*Ò»¶¨Òªfreeµô memcached´«»ØµÄÊý¾Ý*/
            continue;
        }
        else if (rc == M


Ïà¹ØÎĵµ£º

Ò»¸öLinuxÏÂCÏ̳߳صÄʵÏÖ

ʲôʱºòÐèÒª´´½¨Ï̳߳ØÄØ£¿¼òµ¥µÄ˵£¬Èç¹ûÒ»¸öÓ¦ÓÃÐèҪƵ·±µÄ´´½¨ºÍÏú»ÙỊ̈߳¬¶øÈÎÎñÖ´ÐеÄʱ¼äÓַdz£¶Ì£¬ÕâÑùÏ̴߳´½¨ºÍÏú»ÙµÄ´øÀ´µÄ¿ªÏú¾Í²»ÈݺöÊÓ£¬ÕâʱҲÊÇÏ̳߳ظóö³¡µÄ»ú»áÁË¡£Èç¹ûÏ̴߳´½¨ºÍÏú»Ùʱ¼äÏà±ÈÈÎÎñÖ´ÐÐʱ¼ä¿ÉÒÔºöÂÔ²»¼Æ£¬ÔòûÓбØҪʹÓÃÏ̳߳ØÁË¡£
ÏÂÃæÊÇLinuxϵͳÏÂÓÃCÓïÑÔ´´½¨µÄÒ»¸öÏ̳߳ء£Ï̳߳ػ ......

[VC]º¯Êýµ÷ÓÃÔ¼¶¨½âÎö(C/C++)

C/C++º¯Êýµ÷ÓÃÔ¼¶¨ºÍº¯ÊýÃû³ÆÐÞÊιæÔò̽ÌÖ
×÷ÕߣºÐǹ죨oRbIt£©
 
ʹÓÃC/C++ÓïÑÔ¿ª·¢Èí¼þµÄ³ÌÐòÔ±¾­³£Åöµ½ÕâÑùµÄÎÊÌ⣺ÓÐʱºòÊdzÌÐò±àÒëûÓÐÎÊÌ⣬µ«ÊÇÁ´½ÓµÄʱºò×ÜÊDZ¨¸æº¯Êý²»´æÔÚ£¨¾­µäµÄLNK
2001´íÎ󣩣¬ÓÐʱºòÊdzÌÐò±àÒëºÍÁ´½Ó¶¼Ã»ÓдíÎ󣬵«ÊÇÖ»Òªµ÷ÓÿâÖеĺ¯Êý¾Í»á³öÏÖ¶ÑÕ»Òì³£¡£ÕâЩÏÖÏóͨ³£ÊdzöÏÖÔÚCºÍC ......

C/C++ÖеÄ64λÕûÊý£¨__int64 and long long£©

¡¡¡¡ÔÚ×öACMÌâʱ£¬¾­³£¶¼»áÓöµ½Ò»Ð©±È½Ï´óµÄÕûÊý¡£¶ø³£ÓõÄÄÚÖÃÕûÊýÀàÐͳ£³£ÏÔµÃ̫СÁË£ºÆäÖÐlong ºÍ int
·¶Î§ÊÇ[-2^31,2^31)£¬¼´-2147483648~2147483647¡£¶øunsigned·¶Î§ÊÇ[0,2^32)£¬¼´
0~4294967295¡£Ò²¾ÍÊÇ˵£¬³£¹æµÄ32λÕûÊýÖ»Äܹ»´¦Àí40ÒÚÒÔϵÄÊý¡£
¡¡¡¡ÄÇÓöµ½±È40ÒÚÒª´óµÄÊýÔõô°ìÄØ£¿Õâʱ¾ÍÒªÓõ½C++µÄ64λÀ©Õ¹ ......

C/C++ std::string ÇдÊ

ÓÃÁËÈýÖÖ·½·¨...
#if 0
void StringTokenize(const std::string& strSrc, const std::string& strDelimit, std::vector<std::string>& vecSub)
{
if (strSrc.empty() || strDelimit.empty())
{
throw "tokenize: empty string\n";
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ