有名管道后 && gtk_window_set_opacity

http://www.cnblogs.com/hicjiajia/archive/2011/01/20/1940154.html


方式一:mkfifo("myfifo","rw");

  方式二:mknod myfifo p

  生成了有名管道后,就可以使用一般的文件I/O函数如open、close、read、write等来对它进行操作。下面即是一个简单的例子,假设我们已经创建了一个名为myfifo的有名管道。

 1/* 进程一:读有名管道*/
 2#include <stdio.h>
 3#include <unistd.h>
 4void main() {
 5    FILE * in_file;
 6    int count = 1;
 7    char buf[80];
 8    in_file = fopen("mypipe""r");
 9    if (in_file == NULL) {
10        printf("Error in fdopen.\n");
11        exit(1);
12    }
13    while ((count = fread(buf, 180, in_file)) > 0)
14        printf("received from pipe: %s\n", buf);
15    fclose(in_file);
16}
17/* 进程二:写有名管道*/
18#include <stdio.h>
19#include <unistd.h>
20void main() {
21    FILE * out_file;
22    int count = 1;
23    char buf[80];
24    out_file = fopen("mypipe""w");
25    if (out_file == NULL) {
26        printf("Error opening pipe.");
27        exit(1);
28    }
29    sprintf(buf,"this is test data for the named pipe example\n");
30    fwrite(buf, 180, out_file);
31    fclose(out_file);
32}
33



gtk_window_set_opacity

void gtk_window_set_opacity (GtkWindow *self,
gdouble opacity);

Request the windowing system to make @window partially transparent,with opacity 0 being fully transparent and 1 fully opaque. (Valuesof the opacity parameter are clamped to the [0,1] range.) On X11this has any effect only on X screens with a compositing managerrunning. See gtk_widget_is_composited(). On Windows it should workalways.Note that setting a window's opacity after the window has beenshown causes it to flicker once on Windows.


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值