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

Linux FIFO代码问题 - Linux/Unix社区 / 程序开发区

/*speak.c*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#define FIFO_NAME "american_maid"
int main(void)
{
char s[300];
int num, fd;
mknod(FIFO_NAME, S_IFIFO | 0666, 0);
printf("waiting for readers...\n");
fd = open(FIFO_NAME, O_WRONLY);
printf("got a reader--type some stuff\n");
while (gets(s), !feof(stdin)) {
if ((num = write(fd, s, strlen(s))) == -1)
perror("write");
else
printf("speak: wrote %d bytes\n", num);
}
return 0;
}

/*tick.c*/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#define FIFO_NAME "american_maid"
int main(void)
{
char s[300];
int num, fd;
mknod(FIFO_NAME, S_IFIFO | 0666, 0);
printf("waiting for writers...\n");
fd = open(FIFO_NAME, O_RDONLY);
printf("got a writer\n");
do {
if ((num = read(fd, s, 300)) == -1)
perror("read");
else {
s[num] = '\0';
printf("tick: read %d bytes: \"%s\"\n&


相关问答:

linux桌面进不去了,怎么办………………

在自己的电脑上安装了ubuntu 就是想玩一下3D桌面,于是下载了 
compizconfig-settings-manager 
emerald 
simple-ccsm 
fusion 
这些东西,安装完之后,我在电脑里点击了emerald ......

linux命令大全 - Linux/Unix社区 / UNIX文化

咨询QQ:269562808
bzip2recover
功能说明:用来修复损坏的.bz2文件。
语法:bzip2recover[.bz2压缩文件]
补充说明:bzip2是以区块的方式来压缩文件,每个区块视为独立的单位。因此,当某一区
块损坏时,便可利 ......

是选win2008还是suse linux、redhat、centos,犹豫中

引用内容vsking 2009-12-25 22:56:52
现在是win2008和iis8的时代了,不要还停留在iis5时代,win2008被评为十佳操作系统之首不是偶然的,你要是..
我的问题是:
最近想买个服务器,看了dell上的系统定制选择,一些 ......

FCK上传文件到linux服务器问题 - Java / Java EE

请我用FCK上传文件,在本地的windows机上测试可以,但部署到linux服务器上就上传不了文件,上传文件时一直卡在那里。望各位大虾指点,谢谢!
路过,帮你顶一下。。。。。。。。。。。。。。

上传文件的路径问题, ......

linux 下的SSH问题! - Web 开发 / 应用服务器

各位大虾,先问声好!
  想请教一下在window下用putty怎么部署linux服务器上的SSH框架,数据库和tomcat都安装好了,jdk也装上去了,现在就是怎么在上面搭建SSH框架了!求各位不吝赐教!或者提供相应 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号