📄 tom.c
字号:
/* tom.c v3.0 */#include <unistd.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <stdlib.h>#include <stdio.h>#include <errno.h>#define FIFO "message.fifo"int main(){ int fifo; char msg[] = "I love you.\n"; ssize_t s; /* Create FIFO. */ if ((mkfifo(FIFO, 0666)<0) && (errno!=EEXIST)) perror("mkfifo"); if (fork()==0) { /* Execue Jerry. */ if(execvp("./jerry", NULL)<0) perror("execvp"); } else { /* Open FIFO. */ fifo = open(FIFO, O_WRONLY); if(fifo < 0) { perror("open"); } /* Write message. */ s = write(fifo, &msg, sizeof(msg)-1); /* Close file. */ close(fifo); } exit(EXIT_SUCCESS);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -