摘要:
// str.h#ifndef STR_H#define STR_Hchar * trim(char *c,int mode);char** split(const char* string, char delim, int* count);#endif// str.c#include #inclu... 阅读全文
随笔分类 - UsefulCodes
md5
2015-06-10 23:54 by sylar_liang, 251 阅读, 收藏,
摘要:
C++实现:// MD5.h#ifndef MD5_H#define MD5_H#include #include #include /* Type define */typedef unsigned char byte;typedef unsigned int bit32;using std::s... 阅读全文
base64实现
2015-06-10 23:26 by sylar_liang, 408 阅读, 收藏,
摘要:
C语言版本:#include /* aaaack but it's fast and const should make it shared text page. */static const unsigned char pr2six[256] ={ /* ASCII table */ ... 阅读全文
C/C++ 基础编程
2015-06-05 13:55 by sylar_liang, 395 阅读, 收藏,
摘要:
1.将int赋值给字符串(char数组或者string)char cBuf[10] = {0};方法1: sprintfsprintf(cBuf, "%d", n);string strTemp = cBuf;2.截取string字符串的其中一部分方法1: substrstring str1 = "... 阅读全文
应用程序唯一性
2015-06-05 00:31 by sylar_liang, 397 阅读, 收藏,
摘要:
程序启动后,如果再次启动程序,不会出现2个程序,或者实现如Notepad++已打开一个文件,再打开另外一个文件,则追加在Notepad++界面上。使用codeproject上别人编写的一个类,加在程序启动时即可。sinstance.h/*Module : SINSTANCE.HPurpose: De... 阅读全文
字节对齐
2015-03-26 15:11 by sylar_liang, 154 阅读, 收藏,
摘要:
#define APR_ALIGN(size, boundary) / (((size) + ((boundary) - 1)) & ~((boundary) - 1))该宏目的为: 计算出最接近size的boundary的整数倍的整数.如:APR_AGLIN(7,4) = 8. 即 (7+3) &... 阅读全文
C++ 唯一实例类
2015-03-19 23:38 by sylar_liang, 1179 阅读, 收藏,
摘要:
通过Instance 来产生一个实例指针。使用:class ServerSessionFactory: public Singleton// Singleton.h: 唯一实例// 通过调用 Instance 来初始化得到唯一实例///////////////////////////////////... 阅读全文
浙公网安备 33010602011771号