home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 2 / DATAFILE_PDCD2.iso / utilities2 / desklib / Libraries / File / c / Exists next >
Encoding:
Text File  |  1993-07-12  |  1.0 KB  |  32 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    File.Exists.c
  12.     Author:  Copyright © 1993 Jason Williams
  13.     Version: 1.00 (12 Jul 1993)
  14.     Purpose: Checks if a given file exists (can be read)
  15.              Note that directories cannot be read, so will be returned as
  16.              non existent.
  17. */
  18.  
  19.  
  20. #include "DeskLib:File.h"
  21.  
  22.  
  23. extern BOOL File_Exists(char *filename)
  24. {
  25.   file_handle test;
  26.  
  27.   test = File_Open(filename, file_READ);
  28.   if (test != NULL) File_Close(test);
  29.  
  30.   return (test != NULL);
  31. }
  32.