⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p3-3.c

📁 UNIX程序设计教程
💻 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 + -