Sun Studio 12: Fortran Library Reference

1.4.53 unlink: Remove a File

The function is called by:

INTEGER*4 unlink

n = unlink ( patnam )

patnam

character*n

Input 

File name 

Return value 

INTEGER*4

Output 

n=0: OK

n>0: Error

The function unlink removes the file specified by path name patnam. If this is the last link to the file, the contents of the file are lost.

Example: unlink()—Remove the tunlink.data file:


demo% cat tunlink.f
       call unlink( ’tunlink.data’ )
       end
demo% f95 tunlink.f
demo% ls tunl*
tunlink.f tunlink.data
demo% a.out
demo% ls tunl*
tunlink.f

See also: unlink(2), link(3F), and perror(3F). Note: the path names cannot be longer than MAXPATHLEN as defined in <sys/param.h>.