Deleting a file does not remove the contents of the file; the OS just says that the space can be used by another file. I want to write a program that permanently deletes a file. Here's what I've thought of:
1. open the file and overwrite the existing data with garbage data equal to the number of bytes in the file
2. rename the file to some garbage
3. then delete the file
Would this work on Windows? On NetBSD I renamed a file, and then did a cat on the directory (a directory is a file that contains the listing of the files inside of it) and still saw the name of the old file name in output.