access, remove

 
//
// g++ -std=c++0x t1.cpp -o t1
//
#include <string>
#include <iostream>
#include <unistd.h>

int main(int argc, char ** argv)
{
  std::string fileName( getenv( "PWD"));
  fileName += "/hasylab_00001.nxs";
  std::cout << "fileName " << fileName << std::endl;

  if( access( fileName.c_str(), F_OK) == 0){
    std::cout << " deleting " << fileName << std::endl;
    remove( fileName.c_str()); 
  }
}