易截截图软件、单文件、免安装、纯绿色、仅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);
   
这就是初始化的全部代码,可以设置很多东西,不过我现在只要一个服务器,就看一句话:
    servers= memcached_servers_parse("127.0.0.1:12300");
这就是指明要连接到位于127.0.0.1监听12300端口的memcached程序. 其他都不管。
最后用一段修改后的代码介绍两个函数,memcached_get和memcached_set,都可以man出来。
        char * result_str; /*这个就是查询的结果*/
        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


相关文档:

(windows下)用Eclipse搭建C/C++开发环境

--------如果你用的是或打算用Eclipse For C++,那么从这里看,
1. 首先下载Eclipse for C++, 最新版是基于Eclipse 3.5.2的,eclipse-cpp-galileo-SR2-win32.zip
2. 解压,直接运行。注意,至少JDK你已经安装了(我用的是JDK1.6)。运行后welcome页面出现,进入Tutorials。先读Tutorial是个好习惯。
3. 首先 什么是CDT... ......

样例解析_C盘防毒批处理.bat

@echo off
@echo ╔┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉┉╗
@echo ┋ 心 如 止 水 ┋
@echo ┋ ┋
@echo ┋ DIY 个 性 BAT C 盘 防 毒 批 处 理 ┋
@echo ┋ ......

Optimizing Your C/C++ Applications


C/C++ optimizing compilers are great--but there *are* a few techniques for hand-tuning your code to run as efficiently as possible on the AMD Athlon64 and Opteron processors, especially when developing DLLs, device drivers, or other performance-bound pieces of code.
Alan Zeichick  
Share | ......

C/S模式与B/S模式的比较分析

一、C/S模式与B/S模式的比较分析
  C/S模式主要由客户应用程序(Client)、服务器管理程序(Server)和中间件(middleware)三个部件组成。客户应用程序是系统中用户与数据进行交互的部件。服务器程序负责有效地管理系统资源,如管理一个信息数据库,其主要工作是当多个客户并发地请求服务器上的相同资源时,对这些资源进行最 ......

C/C++ 与运算和或运算转换大小写

// & 与,将指定位置设置为0     | 或,将指定位置设置为1
//注: 只针对纯字母的情况
#include <stdio.h>
#include <string>
int main()
{
char str[6] = "xxing";
std::string str1 = "INGXX";
for(int i = 0; i < 5; i++)
{
str[i] &= 0xdf; ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号