Fortran Library Reference

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:


    call unlink( 'tunlink.data' )
    end
demo% f77 -silent tunlink.f
demo% ls tunl* 
tunlink.f tunlink.data
demo% a.out
demo% ls tunl*
tunlink.f
demo%

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