06 2013 档案

摘要:Windows中提供了一个宏#define CONTAINING_RECORD (address, type, field ) ((type *)( \ (PCHAR)(address ) - \ (ULONG_PTR)(&((type *)0)->field))) address : 结构体内成员实际地址type : 结构体类型field : 结构体内成员字段名称作用: 更加提供的结构体成员地址反... 阅读全文
posted @ 2013-06-18 23:08 蒲蜡 阅读(468) 评论(0) 推荐(0)
摘要:C语言中可以用函数地址直接调用函数:实例代码:void print (){ printf ("function print");}typdef void (*fun)();fun f = print;f();C++中类非静态成员函数必须通过实例去调用,C++中类成员函数调用:class test{public:void print (){ printf ("function print");}};我们同样可以通过定义函数指针来调用如下:typedef void (test::*fun)();fun f = &test::print;test t; 阅读全文
posted @ 2013-06-08 21:02 蒲蜡 阅读(4373) 评论(0) 推荐(1)
摘要:C语言中提供了对时间进行操作的函数和数据结构,下面介绍几种常用的函数。首先是表示时间的time_t类型,在32位windows VS2010中定义为long long类型,占8个字节,表示自1970年1月1日0时0分0秒到现在的秒数。表示日期结构tm定义如下:structtm {inttm_sec;/* seconds after the minute - [0,59] */inttm_min;/* minutes after the hour - [0,59] */inttm_hour;/* hours since midnight - [0,23] */inttm_mday;/* day 阅读全文
posted @ 2013-06-04 21:56 蒲蜡 阅读(557) 评论(0) 推荐(0)