File:  [MW Coherent from dump] / coherent / a / usr / man / ALL / fileno
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:34 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent



fileno()                  STDIO Function                 fileno()




Get file descriptor

#include <stdio.h>
iinntt ffiilleennoo(_f_p) FFIILLEE *_f_p;

fileno  returns  the file  descriptor  associated  with the  file
stream fp.   The file descriptor is the  integer returned by open
or creat.  It is used by  routines such as fopen to create a FFIILLEE
stream.

***** Example *****

This example reads a file descriptor and prints it on the screen.


#include <stdio.h>



main(argc,argv)
int argc; char *argv[];
{
        FILE *fp;
        int fd;



        if (argc !=2) {
                printf("Usage: fd_from_fp filename\n");
                exit(0);
        }



        if ((fp = fopen(argv[1], "r")) == NULL) {
                printf("Cannot open input file\n");
                exit(0);
        }



        fd = fileno(fp);
        printf("The file descriptor for %s is %d\n",
                argv[1], fd);
}


***** See Also *****

FILE, file descriptor, STDIO






COHERENT Lexicon                                           Page 1



unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.