--- unlink.cc Wed Jan 16 10:25:37 2002 +++ unlink-new.cc Wed Jan 16 10:45:33 2002 @@ -1,7 +1,9 @@ #include +#include #include #include #include +#include #include using namespace std; @@ -17,7 +19,16 @@ exit(1); } - int status = unlink(file); + char *newfnm = new char[strlen(file) + 2]; + strcpy(newfnm, file); + strcat(newfnm, ".d"); + int status = rename(file, newfnm); + if (status == -1) + { + cerr << "rename() failed with errno = " << errno << endl; + exit(1); + } + status = unlink(newfnm); if (status == -1) { cerr << "unlink() failed with errno = " << errno << endl;