getfilep man page on Solaris

Man page or keyword search:  
man Server   20652 pages
apropos Keyword Search (all sections)
Output format
Solaris logo
[printable version]

GETFILEP(3F)							  GETFILEP(3F)

NAME
       getfilep - get the file pointer of an external unit number

DESCRIPTION
       getfilep	 returns  the  file  pointer of an external unit number if the
       unit is connected.
       If the unit is not connected, the value returned is -1.

NOTE
       This function is used for mixing standard FORTRAN I/O with C I/O.  Such
       mixing in nonportable, and is not guaranteed for subsequent releases of
       the operating system or FORTRAN.	 Use of this function  is  not	recom‐
       mended, and no direct interface is provided.  You must enter your own C
       routine to use the value returned by getfilep.  A sample C  routine  is
       shown below.

USAGE
       Following  is  a	 sample	 FORTRAN  main program with getfilep, the file
       MixStdinmain.f:

	     character*1  inbyte
	     integer*4	  c_read,  getfilep, unitn / 5 /
	     external	  getfilep
	     write(*,'(a,$)') 'What is the digit? '

	     irtn = c_read ( getfilep ( unitn ), inbyte, 1 )

	     write(*,9)	 inbyte
	   9 format('The digit read by C is ', a )
	     end

       Following is a sample C function that actually uses getfilep, the  file
       MixStdin.c:

       #include <stdio.h>
       int c_read_ ( fd, buf, nbytes, buf_len )
       FILE **fd ;
       char *buf ;
       int *nbytes, buf_len ;
       {
	  return fread ( buf, 1, *nbytes, *fd ) ;
       }

       A sample compile/build/run:

       demo% cc -c MixStdin.c
       demo% f77 MixStdin.o MixStdinmain.f
       MixStdinmain.f:
	MAIN:
       demo%
       a.out
       What is the digit?  3
       The digit read by C is 3

       See  the	 chapter  on  the C-FORTRAN interface in the FORTRAN 77 User's
       Guide.

FILES
       libfui.a

SEE ALSO
       open(2)

				 07 July 1995			  GETFILEP(3F)
[top]

List of man pages available for Solaris

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net