Table Of Contents
Previous Section Next Section

Program 99: Phantom File

There's no file named delete.me in our directory. So why does this program keep telling us to remove it?

  1 /*************************************************
  2  * delete_check -- Check to see if the file      *
  3  * delete.me exists and tell the user            *
  4  * to delete it if it does.                      *
  5  *************************************************/
  6 #include <iostream>
  7 #include <unistd.h>
  8 #include <cstdio>
  9
 10 int main()
 11 {
 12     // Test for the existence of the file
 13     if (access("delete.me", F_OK)) {
 14         bool remove = true;
 15     }
 16     if (remove) {
 17         std::cout <<
 18             "Please remove 'delete.me'\n";
 19     }
 20     return (0);
 21 }

(Next Hint 98. Answer 35.)

Table Of Contents
Previous Section Next Section