易截截图软件、单文件、免安装、纯绿色、仅160KB

Pipe is a worm hole connecting C and C++

In C programming language, the observer design pattern is implemented with function pointer (aka callback function). But in Qt library, it introduces signal and slot. How to link a callback function from the C callback function to the C++ siganl and slot is a problem I encounter. Call back function can only be static, but signal and slot can not. There are some triky way to pretend a non-static function to a static function. But the easiest way is to use pipe. the callback function create a pipe and do the read operation, while the siganl function wait for and read at the other end of the pipe.
The pipe is like a worm hole connecting C and C++, two different time and space. How cool!


相关文档:

C/C++程序员面试题

 1、局部变量能否和全局变量重名?  
 答:能,局部会屏蔽全局。要用全局变量,需要使用"::" ;局部变量可以与全局变量同名,在函数内引用这个变量时,会用到同名的局部变量,而不会用到全局变量。对于有些编译器而言,在同一个函数内可以定义多个同名的局部变量,比如在两个循环体内都定义一个同名的局部变量,而那 ......

关于C中结构体的大小问题(sizeof)

作者:
曾宏安,华清远见嵌入式学院
高级讲师。
运算符sizeof可以计算出给定类型的大小,对于32位系统来说,sizeof(char) = 1; sizeof(int) = 4。基本数据类型的大小很好计算,我们来看一下如何计算构造数据类型的大小。
C语言中的构造数据类型有三种:数组、结构体和共用体。
数组是相同类型的元素的集合,只要会计算 ......

Exper C Programming 零零散散

1.
关于char* 和const char*以及char**和const char**分别作为实参和形参的问题
传值实际上是类似于赋值的。
两个操作数都是指向限定符或无限定符的相容类型的指针,左边指针所指向的类型必须具有右边指针所指向类型的全部限定符。 ......

打印自己的一段漂亮C程序

打印自己的一段漂亮C程序
#include <stdio.h>
int main()
{
  char *p ="#include <stdio.h>%c int main(){char *p=%c%s%c; printf(p, 10, 34, p, 34);}";
  printf(p, 10, 34, p, 34);
} ......

C/C++面试题

1.介绍一下STL,详细说明STL如何实现vector.
    Answer:
    STL (标准模版库,Standard Template Library.它由容器算法迭代器组成。
    STL有以下的一些优点:可以方便容易地实现搜索数据或对数据排序等一系列的算法;调试程序时更加安全 和方便;即使是人们用STL在 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号