Permanently deleting files

This is a discussion on Permanently deleting files within the Windows Programming forums, part of the Platform Specific Boards category; Deleting a file does not remove the contents of the file; the OS just says that the space can be ...

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    224

    Permanently deleting files

    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.

    Thanks,
    Yasir

  2. #2
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with loading files into rich text box
    By blueparukia in forum C# Programming
    Replies: 3
    Last Post: 10-19-2007, 12:59 AM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 01:30 PM
  3. fopen vs. _open (for BIG image files)
    By reversaflex in forum C Programming
    Replies: 3
    Last Post: 04-01-2007, 12:52 AM
  4. I/O with files, deleting.
    By Ezzetabi in forum C++ Programming
    Replies: 1
    Last Post: 03-23-2005, 11:28 AM
  5. deleting files not in fstream?
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 10-09-2001, 01:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21