易截截图软件、单文件、免安装、纯绿色、仅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命令大全 - Linux/Unix社区 / UNIX文化

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

linux shutdown - Linux/Unix社区 / UNIX文化

大家好,我现在正在学习linux系统,碰到点问题想请问大家,希望前辈能够指教。
在linux中为什么我用shutdown -r now 命令来重启系统没有用呢,而reboot命令就可以。
另外我也试过#shutdown -r now 和
shutdow等命 ......

linux下清除eclipse中的svn插件密码 - Java / Java SE

在linux下安装的eclipse,在eclispe中安装了svn插件, 如果修改和删除svn密码?
csdn不是很多高手么? 或者有谁知道windows下的C:\Documents and Settings\Administrator\Application Data这个目录对应到linux哪个目 ......

Linux上网问题 - Linux/Unix社区 / 系统维护与使用区


我装的是SUSELinux,之前把IP设置这些设置好后,并且是NAT连接方式,我的Linux就直接可以上网了。
但是我们老师给我改成桥接方式后,就不能上网了,我在改回NAT,还是不能,希望有人帮忙。
或者提供更加详细准确 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号