client.c
来自「simple client/server in socket and fifo 」· C语言 代码 · 共 27 行
C
27 行
#include<stdio.h>#include<stdlib.h>#include<unistd.h>#include<sys/types.h>#include<sys/stat.h>#include<fcntl.h>#include<string.h> int main(){ char buff[200]; int fl,n,fl2; printf("FIFO's created"); fl=open("fifo1",O_WRONLY); printf("enter the filename"); scanf("%s",buff); printf("sending this filename to the server");write(fl,buff,strlen(buff));close(fl);printf("waiting for server reply"); fl2=open("fifo2",O_RDONLY); while((n=read(fl2,buff,128))>0) write(1,buff,n); close(fl2); return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?