#include #include #include #include #include #include int main(int argc, char *argv[]) { int fd = open("error", O_WRONLY|O_CREAT|O_APPEND, 0644); dup2(fd, 2); close(fd); printf("hello on stdout\n"); fprintf(stderr, "hello on stderr\n"); return EXIT_SUCCESS; }