linux API 获得文件属性
摘要:#include int stat(const char *restrict pathname, struct stat *restrict buf); int fstat(int filedes, struct stat *buf); int lstat(const char *restrict pathname, struct stat *restrict buf); struct stat { mode_t st_mode; /* file type & mode (permissions) */ ino_t st_ino; /* i-node number (serial nu
阅读全文
Linux 服务端设计
摘要:1.细分为逻辑处理线程与IO读写线程,数据库处理线程。2.减少线程之间的锁竞争
阅读全文
Linux Daemon 类程序
摘要:1.后台daemon程序(精灵程序)在Linux中专门提供了一个函数来完成这个daemon化的过程,这个函数的原型如下int daemon (int __nochdir, int __noclose);如果__nochdir的值为0,则将切换工作目录为根目录;如果__noclose为0,则将标准输入,输出和标准错误都重定向到/dev /null。经过这个函数调用后的程序将运行在后台,成为一个daemon程序,而linux下大多的服务都是以此方式运行的。
阅读全文
模板函数 使用的默认void 模板报错
摘要:You must specify the compiler argument -std=c++0x to avoid the following error: test.cpp:5:13: error: default template arguments may not be used in function templates without -std=c++0x or -std=gnu++0x
阅读全文
Linux C++ 使用LuaBind嵌入lua脚本
摘要:1.下载luabind地址http://sourceforge.jp/projects/sfnet_luabind/luabind.0.9.tar.gz解压到luabindeclipse新建LuaBind工程,属性静态库将所有的src目录和luabind目录全部复制进来。添加包含路径包括lua安装路径,lua目录下的include,luabind目录,boost目录;还要加上boost的lib目录2.安装lua开发包yum install lua_devel3.编译成libLuaBind.a4.C++调用luaC++项目要包换lua 和LuaBind这两个库--------test.lua--
阅读全文
Linux 编译安装Boost (转)
摘要:安装依赖#yum install python-devel官网下载最新boost 安装包www.boost.org下载,解压,按照如下步骤:#tar xvzf boost_1_50_0.tar.gz进入boost_1_50_0目录:#cd boost_1_50_0然后是编译安装,boost源码包中有配置脚本,直接用就可以:#sh ./bootstrap.shBuilding Boost.Build engine with toolset gcc... tools/build/v2/engine/bin.linuxx86_64/b2DetectingPython version...2.6Det
阅读全文
Navicat for My SQL 查看中文乱码问题
摘要:1、点击某个连接的 —-连接属性,2、切换到高级选项卡3、去掉勾选的“使用mysql字符集” 选项4、在“编码”处选择65001(UTF-8)5、点击确定再打开数据库查看,可见中文了
阅读全文
修改Linux最大Socket连接限制
摘要:ulimit –n 命令查看fd限制默认会是1000或者1024cat /etc/security/limits.confVi /etc/security/limits.conf添加如下* soft nofile 20480* hard nofile 20480重启电脑,用ulimit -n查看是否修改成功
阅读全文
linux递归删除某个文件夹
摘要:在linux递归删除某个文件夹(svn)的命令:find . -name "*.svn" -type d -print -exec rm -rf {} \;(1) "."表示从当前目录开始递归查找。(2) “ -name "svn" "根据名称来查找。(3) " -type d "查找的类型为目录(4) "-print" 输出查找的文件目录名(5) 最主要的是是-exec了,-exec选项后边跟着一个所要执行的命令,表示将find出来的文件或目录执行该命令。 exec选项后面跟随着所要
阅读全文