|
|
1.1 root 1: #include <stdio.h>
2:
3: main(argc,argv)
4: int argc;
5: char *argv[];
6: {
7: FILE *fp;
8: int fd;
9:
10: if (argc !=2) {
11: fprintf(stderr, "Usage: fileno filename\n");
12: exit(1);
13: }
14:
15: if ((fp = fopen(argv[1], "rw")) == NULL) {
16: fprintf(stderr, "Cannot open input file %s\n",
17: argv[1]);
18: exit(1);
19: }
20:
21: fd = fileno(fp);
22: printf("The file descriptor for %s is %d\n",
23: argv[1], fd);
24: exit(0);
25: }
26:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.