C++
hunker
这个作者很懒,什么都没留下…
展开
-
编码转换
[code="c++"]// 多字节编码转为UTF8编码 bool MBToUTF8(vector& pu8, const char* pmb, int32 mLen) { // convert an MBCS string to widechar int32 nLen = MultiByteToWideChar(CP_ACP, 0, pmb, mLen, NULL, 0);...原创 2011-10-05 14:33:23 · 162 阅读 · 0 评论 -
sql处理之5
[code="c++"]int CSQLMake::MakeOnFilter(std::string &strOn, CParaSet &oInPara){ int iRet = 0; std::string::size_type stPos = strOn.find(" on "); if (stPos != std::string::npos) {...原创 2011-12-20 18:54:22 · 120 阅读 · 0 评论 -
给sql填充数据
[code="c++"]int CSQLMake::MakeSqlFit(std::string &strSql, CParaSet &oInPara){ int iRet = 0; std::string::size_type iPos = strSql.find("where"); if (iPos == std::string::npos) {...原创 2011-12-20 18:51:34 · 409 阅读 · 0 评论 -
将sql语句用paraset中的值给填充一下!
[code="c++"]int CSQLMake::DoSqlFit(std::string &strSql, CParaSet &oInPara){ int iRet = 0; // 拆分sql std::vector vctSql; SplitSql(strSql, vctSql); // 循环处理sql std::vec...原创 2011-12-20 18:39:05 · 232 阅读 · 0 评论 -
将多个sql语句给合并成一个sql
[code="c++"]int CSQLMake::MergeSql(std::string &strSql, std::vector &vctSql){ int iRet = 0; boost::regex regEx("@@([\\d]+)"); boost::match_flag_type flags = boost::match_default; ...原创 2011-12-20 18:32:28 · 894 阅读 · 0 评论 -
使用正则表达式来分割sql语句!
[code="c++"]int CSQLMake::SplitSql(std::string &strSql, std::vector &vctSql){ int iRet = 0; boost::regex regEx("\\(select[\\w\\s='!#,.@]*\\)"); std::string::const_iterator start, end;...原创 2011-12-20 18:30:17 · 1160 阅读 · 0 评论 -
用模板实现引用计数
[code="c++"]#ifndef T_NO_ANSI_CASTS # define T_REINTERPRET_CAST(type,pointer) reinterpret_cast< type >(pointer)# define T_STATIC_CAST(type,pointer) static_cast< type >(pointer)# define T_CONST...2011-10-29 18:29:25 · 81 阅读 · 0 评论 -
简单的时间计算方法
[code="java"]#include #include enum _MLINE{ ML_FILE = 5, ML_TEN = 10, ML_FIFTEEN = 15, ML_TWENTY = 20, ML_THIRTY = 30};int test1(std::string &r, doub...原创 2011-10-19 18:52:42 · 235 阅读 · 0 评论 -
从argv中解析出进程名称
[code="c++"]#include #include #ifdef WIN32#define PATH_SEP "\\"#else#define PATH_SEP "/"#endifint test(int argc, char *argv[]){ std::cout原创 2011-10-10 17:39:19 · 145 阅读 · 0 评论 -
linux 获取内存的方法
[code="c++"]#include int getrusage(int who, struct rusage *r_usage); [/code]利用getrusage可以得到进程的相关资源信息。如:用户开销时间,系统开销时间,接收的信号量等等;下面是rusage的结构:[code="c++"]struct rusage { struct timeval ru...原创 2011-12-21 22:35:40 · 330 阅读 · 0 评论