#include <stdio.h>
int fileno(FILE *stream);
FILE *fdopen(int fildes, const char *mode);
01 #include <stdio.h>
02 #include <sys/types.h>
03 #include <sys/stat.h>
04
05 main()
06 {
07 FILE *stream;
08 struct stat buf;
09 int n;
10
11 stream = fopen("new-1","r");
12 n = fileno(stream);
13
14 printf("FD is %d\n",n);
15
16 fstat(n,&buf);
17
18 printf(" mode: %o\n", buf.st_mode);
19
20 return 0;
21 }
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |