#include <stdio.h>
int fileno(FILE *stream);
#include <stdio.h>
#include <unistd.h>
int main ()
{
FILE *stream;
printf ("stdin is: %d\n", fileno(stdin));
printf ("stdout is: %d\n", fileno(stdout));
printf ("stderr is: %d\n", fileno(stderr));
stream = fopen ("./mps.c", "r");
printf ("new open file's fd is: %d\n", fileno(stream));
fclose (stream);
return (0);
}
./fileno
stdin is: 0
stdout is: 1
stderr is: 2
new open file's fd is: 3
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |