Fortran Library Reference

symlnk: Create a Symbolic Link to an Existing File

Example 2: symlnk: Create a symbolic link named data1 to the file, tlink.db.data.1:


demo% cat tsymlnk.f
    character*34 name1/'tlink.db.data.1'/, name2/'data1'/
    INTEGER*4 status, symlnk
    status = symlnk( name1, name2 )
    if ( status .ne. 0 ) stop 'symlnk: error'
    end
demo% f77 -silent tsymlnk.f 
demo% ls -l data1 
data1 not found 
demo% a.out 
demo% ls -l data1 
lrwxrwxrwx 1 generic 15 Aug 11 11:09 data1 -> tlink.db.data.1 
demo% 

See also: link(2), symlink(2), perror(3F), and unlink(3F).

Note: the path names cannot be longer than MAXPATHLEN as defined in <sys/param.h>.