/*
* main.c
*
* Created on: 2024-6-11
* Author: root
*/
#include
#include
#include
#include
#include
#include
int main()
{
int fd;
if((fd=open("output",O_CREAT | O_RDWR,0644))==-1)
{
perror("open or creat file failed!");
return 1;
}
close(1);
dup(fd);
close(fd);
puts("this line dsta will output to file");
return 0;
}
运行效果
文章评论(0条评论)
登录后参与讨论