#include
#include
#include
int main(void)
{
int fd;
printf(“Hello #1\n”);
fd = open(“myfile.txt”,
O_WRONLY | O_CREAT,
0644);
dup2(fd, STDOUT_FILENO);
close(fd);
printf(“Hello #2\n”);
return 0;
}
#include
#include
#include
int main(void)
{
int fd;
printf(“Hello #1\n”);
fd = open(“myfile.txt”,
O_WRONLY | O_CREAT,
0644);
dup2(fd, STDOUT_FILENO);
close(fd);
printf(“Hello #2\n”);
return 0;
}