Sun Studio 12: Fortran Library Reference

1.4.24 hostnm: Get Name of Current Host

The function is called by:

INTEGER*4 hostnm

status = hostnm( name )

name

character*n

Output 

Name of current host system. n must be large enough to hold the host name.

Return value 

INTEGER*4

Output 

status=0: OK

status>0: Error

Example: hostnm():


      INTEGER*4 hostnm, status
      character*8 name
      status = hostnm( name )
      write(*,*) ’host name = "’, name, ’"’
      end

See also gethostname(2).