fileno

Returns the file handle for a stream (function or macro)

Local Servers:nonblocking
Remote Servers:nonblocking
Platform:NLM
Service:Stream I/O

Syntax

  #include <stdio.h>  
   
  int fileno  (  
     FILE   *fp);
  

Parameters

fp
(IN) Points to a stream opened with a previous call to fopen or fdopen.

Return Values

fileno returns the file handle designated by the fp parameter.

If an error occurs, errno is set to:

4

EBADF

Bad file number.

If fileno does not complete successfully, NetWareErrno is set.

Remarks

The returned file handle can be used to access the stream with any of the functions that take a handle.

There are two versions of fileno in the NetWare API:

  • The fileno macro in STDIO.H does not do any error checking against a bad file pointer.
  • The fileno function checks the handle passed in. If you want to use this function and are including STDIO.H, place a sequence such as the following in your code:
            #ifdef fileno  
            #undef fileno  
            #endif
      

See Also

close, creat, eof, filelength, fdopen, fopen, fstat, isatty, lseek, open, read, sopen, tell, write