📄 p3-3.c
字号:
#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <sys/stat.h>#include <sys/types.h>#include "err_exit.h"int main(void){ int fd; if((fd = open("myoutput",O_WRONLY|O_CREAT,0644)) == -1) err_exit("myoutput "); /* 重复标准输出至描述字fd相连的文件myoutput */ if (dup2(fd,STDOUT_FILENO) == -1) err_exit("Redirect standar output failed"); printf("this is a test program for redirect \n"); close(fd);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -