First of all, it's better to use the predefined constants for standard fds STDIN_FILENO
,STDOUT_FILENO
,STDERR_FILENO
.
Also, you have to close
an opened file when you're done writing to it. Anyway: You're not actually writing to the file you've opened in this example. What output did you expect?