
; Copyright (c) 1998, Forschungszentrum Juelich GmbH ICG-1
; All rights reserved.
; Unauthorized reproduction prohibited.
; This software may be used, copied, or redistributed as long as it is not
; sold and this copyright notice is reproduced on each copy made.  This
; routine is provided as is without any express or implied warranties
; whatsoever.
;
;+
; NAME:
;   file_exist
;
; PURPOSE:
;   The result of this function is 1 if a file exist and 0 if not
;
; CATEGORY:
;   DATAFILES
;
; CALLING SEQUENCE:
;   Result=file_exist(file_name)
;
; INPUTS:
;   file_name: The name of the File
;
; OUTPUTS:
;   This function returns 1 if the file exist and 0 if not
;
; EXAMPLE:
;   result=file_exist('otto.nc')
;
; MODIFICATION HISTORY:
; 	Written by:	R.Bauer (ICG-1),  1998-May-18
;-

FUNCTION file_exist,file_name
 if n_params() lt 1 then begin
      help,call=call
      help_of_interest=within_brackets(call[0],brackets=['<','('])
      message,help_calling_sequence(help_of_interest),/cont
      return,-1
   endif

   OPENR,lun,file_name,err=err,/GET_LUN
   IF n_elements(lun) GT 0 THEN FREE_LUN,lun
   IF err NE 0 THEN RETURN,0 ELSE RETURN,1
END









