fileExists

 

  #include <sys/types.h> 
  #include <sys/stat.h>

  long fileExists( string fileName)
  {
    struct stat s; 
  
    long argout = 0; 

    if (!stat( fileName.c_str(), &s))
      {
        argout = 1;
      }
    else
      {
        argout = 0; 
      }
    return argout;
  }