wfifo.cc
来自「达内IT培训Unix C++第三天源码 是入门Unix 下C++编程的好东西」· CC 代码 · 共 28 行
CC
28 行
#include <iostream>using namespace std;#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>#include <fcntl.h>#include <string>int main(){ mkfifo("abc", 0600); int fd = open("abc", O_WRONLY); if(fd<0){ cout << "error open!" << endl; return -1; } cout << "open OK!" << endl; for(;;){ cout << "input:"; string str; getline(cin, str); write(fd, str.c_str(), str.size()); if(str=="bye") break; } close(fd);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?