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!
相关文档:
http://www.vckbase.com/document/viewdoc/?id=1711
作者:求是赤子
一、系统环境
Linux 操作系统 kernel2.4.2,安装 gsoap2.6 到目录/usr/local/gsoap
二、gSOAP 的简要使用例子
下面是一个简单的例子,实现一个加法运算的 WebService,具体功能是客户端(client)输入 num1 和 num2,服务器端(server)返回 num ......
BS与CS的联系与区别[转]
5
推荐
java适合开发bs结构,cs不是它的强项.
C/S是Client/Server的缩写。服务器通常采用高性能的PC、工作站或小型机,并采用大型数据库系统,如Oracle、Sybase、Informix或 SQL Server。客户端需要安装专用的客户端软件。
B/S是Brower/Server的缩写,客户机上只要安装一个浏览器(Browser) ......
一、基本知识
指针和引用的声明方式:
声明指针:char* pc;
声明引用:char& rc = 0;
它们的区别:
①从现象上看,指针在运行时可以改变其所指向的值,而引用一旦和某个对象绑定后就不再改变。这句话可以理解为:指针可以被重新赋值以指向另一个不同的对象。但是引用则总是指向在初始化时被指定的对 ......
打印自己的一段漂亮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);
} ......