#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
void main()
{
int fd;
fd=open("./abc.log", O_RDWR|O_TRUNC|O_CREAT,S_IRUSR|S_IWUSR);
dup2(fd, STDOUT_FILENO);
printf("Write debug log in file abc.log");
close(fd);
}
dup() ---- Linux function dup() to save debug log.
最新推荐文章于 2024-09-09 10:24:53 发布