2010年9月3日

还算好用的线程封装类

摘要: #ifndef _ZKit_ThreadBase_h_ #define _ZKit_ThreadBase_h_ #include "AX_Thread.h" #include "ZKit_Config.h" BEGIN_ZKIT class ThreadBase { public: ThreadBase(int nStackSize = 0); vir... 阅读全文

posted @ 2010-09-03 08:46 joeguo 阅读(278) 评论(0) 推荐(0)

两种实现单件模式代码重用的方法

摘要: #ifndef _ZKit_Singleton_h_ #define _ZKit_Singleton_h_ #include "ZKit_Config.h" BEGIN_ZKIT template <class T> class Singleton { public: static T* instance() { if ( 0 == s_instanc... 阅读全文

posted @ 2010-09-03 08:42 joeguo 阅读(239) 评论(0) 推荐(0)

模仿.net实现的C++ datetime类

摘要: #ifndef _ZKit_DateTime_h_ #define _ZKit_DateTime_h_ #include "ZKit_Config.h" BEGIN_ZKIT class DateTime { public: DateTime(time_t seconds); DateTime(int year,int month,int day); DateTime... 阅读全文

posted @ 2010-09-03 08:40 joeguo 阅读(1083) 评论(0) 推荐(0)

简单易用的C++日志类

摘要: #pragma once #include "SDKDefine.h" #include "AX_Mutex.h" ////////////////////////////////////////////////////////////////////////// enum LogLevel { LogLevel_All, LogLevel_Debug,... 阅读全文

posted @ 2010-09-03 08:28 joeguo 阅读(1180) 评论(2) 推荐(0)

2010年9月2日

用于打印海康设备告警的小程序

摘要: #include <stdio.h> #include <assert.h> #include <time.h> #include <Windows.h> #include "HCNetSDK.h" #define ERR NET_DVR_GetLastError() #define ERR_MSG NET_DVR_GetErr... 阅读全文

posted @ 2010-09-02 12:05 joeguo 阅读(598) 评论(0) 推荐(0)

2010年7月22日

[c++]二分查找算法

摘要: int bsearch(const int* a, int size, int value) { assert(a != NULL && size > 0); if (a == NULL || size < 1) { return -1; } if (value < a[0] || value > a[size - 1]) { return -1; ... 阅读全文

posted @ 2010-07-22 20:08 joeguo 阅读(288) 评论(0) 推荐(0)

2010年7月20日

[c][zz]C语言100个经典算法

摘要: 语言的学习基础,100个经典的算法 C语言的学习要从基础开始,这里是100个经典的算法-1C语言的学习要从基础开始,这里是100个经典的算法 题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔 子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数 为多少? ___________________________________________________... 阅读全文

posted @ 2010-07-20 18:53 joeguo 阅读(567) 评论(1) 推荐(1)

2010年7月14日

[c++][zz]透析C语言可变参数问题

摘要: 原文地址: http://www.cnblogs.com/wangyonghui/archive/2010/07/12/1776068.html 一、是什么 我们学习C语言时最经常使用printf()函数,但我们很少了解其原型。其实printf()的参数就是可变参数,想想看,我们可以利用它打印出各种类型的数据。下面我们来看看它的原型: int printf( const char* format,... 阅读全文

posted @ 2010-07-14 08:36 joeguo 阅读(157) 评论(0) 推荐(0)

[c++][zz]do while(0)妙用

摘要: 在C++中,有三种类型的循环语句:for, while, 和do...while, 但是在一般应用中作循环时, 我们可能用for和while要多一些,do...while相对不受重视。但是,最近在读我们项目的代码时,却发现了do...while的一些十分聪明的用法,不是用来做循环,而是用作其他来提高代码的健壮性。 1. do...while(0)消除goto语句。 通常,如果在一个函数中开始要分... 阅读全文

posted @ 2010-07-14 08:32 joeguo 阅读(303) 评论(0) 推荐(0)

导航