fcntl() function question?
why? follow program output: fd = 0. #include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
int fd;
if ((fd = fcntl(STDOUT_FILENO, F_GETFD, 0)) == -1)
{
printf("fcntl error.\n");
}
printf("fd = %d\n", fd);
exit(0);
}
I think output: fd = 1. where error?