
My Shared Code
文章平均质量分 69
hhf
C / C plus plus
Network Server
3D
展开
-
ado操作store procedure的wrapper
随手写写,有待加强。 YTAdo.h//****************************************************************************************************************************************************************// 文件: YTAdo原创 2010-05-24 09:15:00 · 980 阅读 · 1 评论 -
从一串由指定分割符分隔的串中查找子串
用strtok之前以为用strstr不用循环,结果经测试还是需要有循环,根据80-20原则,所以两种方法的性能未经测试对比,就选了strtok可读性较强的方法,strstr的方法抛之可惜,放到此处保留一下。bool FindToken(char* token,char* blacklist,char delimiter){ int tokenLen=strlen(token); int blacklistLen=strlen(blacklist); char* idx=strstr(bl原创 2011-05-13 11:16:00 · 591 阅读 · 0 评论 -
My C++ Wrapper for FreeTDS
This artical introduce you my C++ wrapper for FreeTDS MSSqlServer interface.With this wrapper you can easily connect/disconnect sqlserver database, and execute insert/delete/update/select/create table commands.This wrapper is not thread-safe and not fully原创 2011-05-25 14:38:00 · 2702 阅读 · 2 评论 -
linux下转换charset
linux下转charset,由于不知道utf8一个字符有多长,所以不知道转换后的串有多长,开大缓冲是一个办法,但是如果输入太大并且并发较高的话有占用内存太大的问题。方案暂时折中为对文件采用命令转换,消息采用大缓冲方式iconv()来转换。不敢全部用命令,开销大。//utf8文件转为gb2312文件int utf8_to_gb2312_file(char* szUtf8FileName,char* szGb2312FileName){ if(szUtf8FileName==NULL || szG原创 2011-04-07 16:29:00 · 956 阅读 · 0 评论 -
My Class for Directory Operation
You can use it in any way, but the author name should always be there.It's nice to leave your suggestions.//author: huanghaifeng#include #include #include #include #include #include #include #include class CDir{ public: enum E原创 2011-05-30 11:54:00 · 736 阅读 · 0 评论 -
wstring与string互转
参考:http://www.velocityreviews.com/forums/t503692-i-need-help-for-std-codecvt.htmlstatic string to_string(const wstring& str, const locale& loc = std::locale("")){ typedef codecvt codecvt_t; const codecvt_t& cc = use_facet(loc); mbstate_t state = mbstate_t(原创 2011-04-13 00:06:00 · 956 阅读 · 0 评论