00001 #ifndef Impala_Basis_FileExists_h
00002 #define Impala_Basis_FileExists_h
00003
00004 #include <cstdio>
00005 #include "Basis/String.h"
00006
00007 namespace Impala
00008 {
00009
00010
00011 inline bool
00012 FileExists(const String& fileName)
00013 {
00014 FILE* fp = fopen(fileName.c_str(), "r");
00015 bool exists = (fp != 0);
00016 if (fp)
00017 fclose(fp);
00018 return exists;
00019 }
00020
00021 inline bool
00022 WritableFile(const String& fileName)
00023 {
00024 FILE* fp = fopen(fileName.c_str(), "a");
00025 bool exists = (fp != 0);
00026 if (fp)
00027 fclose(fp);
00028 return exists;
00029 }
00030
00031
00032 }
00033
00034 #endif