Oracle Solaris Studio 12.4 Man Pages

Exit Print View

Updated: January 2015
 
 

access(3F)

Name

access - return access mode (r,w,x) or existence of a file

Synopsis

integer*4 function access (name, mode)
character*(*) name, mode

Usage

Example: ierr = access ( 'MyFile', 'r' )

Description

The access function checks the given file, name, for accessability with respect to the caller according to mode. The mode argument can include, in any order, and in any combination, one or more of the following:

r

Test for read permission

w

Test for write permission

x

Test for execute permission

(blank)

Test for existence

An error code is returned if either the argument is illegal, or if the file cannot be accessed in all of the specified modes. 0 is returned if the specified access would be successful.

EXAMPLE

To test for read and write permission:

 
integer*4 access, st
st = access('anyfile.data', 'rw')
if( st .ne.0 ) print*, 'Cannot read/write file'

Files

libfui.a

See also

access(2), gerror(3F), perror(3F)