Sun Studio 12: Fortran Library Reference

1.4.6 chmod: Change the Mode of a File

The function is called by:

INTEGER*4 chmod

n = chmod( name, mode )

name

character

Input 

Path name 

mode

character

Input 

Anything recognized by chmod(1),

such as o-w, 444, etc.

Return value 

INTEGER*4

Output 

n = 0: OK; n>0: System error number

Example: chmod—add write permissions to MyFile:


        character*18 name, mode
        INTEGER*4 chmod, n
        name = ’MyFile’
        mode = ’+w’
        n =  chmod( name, mode )
        if ( n .ne. 0 ) stop ’chmod: error’
        end

See also: chmod(1), and gerror(3F) to interpret error codes.

Path names cannot be longer than MAXPATHLEN as defined in <sys/param.h>. They can be relative or absolute paths.