皮皮学,免费搜题
登录
logo - 刷刷题
搜题
【简答题】
根据注解完成文件读写所有填空。管道分为无名管道和有名管道,无名管道用 pipe 创建,有名管道用 mkfifo 创建,管道实际上是文件,一端用于读,一端用于写。 #include #include #include #include #include #include #include int main(int argc,char *argv[]) { int fd[2]; // 创建无名管道 fd if( 填空 1 <0) printf("unable to create noname pipe\n"); else printf("create noname pipe success and the pipe ID are %d and %d \n",fd[0],fd[1]); char * pathname="mkfifofile"; unlink(pathname); // 创建有名管道,其存取权限为最高权限 if( 填空 2 <0) printf("unable to create pipe with name\n"); else printf("create pipe with name success\n"); int filefd; int len; char * buf[1024]; // 创建进程 if( 填空 3 ==0) { // 子进程将 pathname 的内容写入无名管道 len= 填空 4 ; printf("write info into the child of noname pipe is %s and the string length is %d\n",pathname,len); close(fd[0]); close(fd[1]); // 打开有名管道 filefd= 填空 5 ; if(filefd<0) printf("open pipe failed\n"); else { printf("open pipe success\n"); // 子进程将 pathname 的内容写入有名管道 filefd len=write(filefd,pathname,strlen(pathname)); printf("write info into the child of pipe with name is %s and the string length is %d\n",pathname,len); } close(filefd); } else { // 父进程读取无名管道内容到 buf 中 len= 填空 6 ; buf[len]='\0'; printf("read info from the child of noname pipe is %s and the string length is %d\n",buf,len); close(fd[0]); close(fd[1]); filefd=open(pathname,O_RDONLY); if(filefd<0) printf("open pipe failed\n"); else { printf("open pipe success\n"); // 父进程读取有名管道内容到 buf 中 len= 填空 7 ; buf[len]='\0'; printf("read info from the child of pipe with name is %s and the string length is %d\n",buf,len); } // 关闭有名管道 filefd 填空 8 ; } }
手机使用
分享
复制链接
新浪微博
分享QQ
微信扫一扫
微信内点击右上角“…”即可分享
反馈
参考答案:
举一反三
【单选题】运算完下面的C语言程序段以后,a的值是______,b的值是______,c的值是________。nt x=10,y=9; int a,b,c; a=(--x==y++)?--x:++y; b=x++; c=y;
A.
6 9 13
B.
8 7 11
C.
8 9 10
D.
8 7 10
【简答题】C51定义可寻址位。关键字是( )。特殊功能寄存器中的一个位用关键字( )定义。
【多选题】广义的花卉是指( )
A.
花朵美丽的草本观赏植物
B.
可用以观叶、观果为主的草本植物
C.
一些原产南方的盆栽花木类,以及少数的木本名花
D.
只有草本观赏植物
【单选题】运算完下面的C语言程序段以后,a的值是______,b的值是______,c的值是________ int x=10,y=9; int a,b,c; a=(--x==y++)?--x:++y; b=x++; c=y;
A.
6   9   13
B.
8   7   11
C.
8   8   10
D.
8   7   10
【判断题】广义的花卉是草本花卉和室内木本花卉
A.
正确
B.
错误
【简答题】C51 定义可寻址位,使用关键字为 ____ ,特殊功能寄存器的定义可以用 关键字实现,我们写程序时没有定义特殊功能寄存器是因为我们在程序中添加了 头文件。
【简答题】请同学们学习《口腔诊疗器械的清洁、消毒及灭菌》《椅旁四手操作技术》里的教学视频,根据视频请同学在A4纸上撰写口腔器械清洁、消毒及灭菌的实验报告,并在3月18日(周三)晚11点前拍照上传至平台,纸质版请同学们保留好,开学上交作为本学期实验报告和作业。同学们如有疑问可在讨论区发表,老师和同学们可就相关问题进行讨论,或者集中直播答疑。
【多选题】不动产估价的三大基本方法是( )。
A.
假设开发法
B.
路线价法
C.
市场法
D.
成本法
E.
收益法
【简答题】C51 定义可寻址位,关键字是( )
【单选题】运算完下面的 C 语言程序段以后, a 、 b 、 c 的值分别是() 。 int x=10,y=9; int a,b,c; a=(--x==y++)?--x:++y; b=x++; c=y;
A.
6  9  13
B.
8  7  11
C.
8  8  10
D.
8  7  10
相关题目:
参考解析:
知识点:
题目纠错 0
发布
创建自己的小题库 - 刷刷题