CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Delete a file

  1. #1
    Join Date
    May 2009
    Posts
    7

    Question Delete a file

    I have to create a file but after the application closes, it must also be deleted
    I have to run and test the application again and again many times that my trashbin gets larger in size with this...trash .
    Is there an api or a way to delete the file without sending it into the trashbin ? ?
    Thanks

  2. #2
    Join Date
    Dec 2007
    Posts
    33

    Re: Delete a file

    DeleteFile()

  3. #3
    Join Date
    May 2009
    Posts
    7

    Re: Delete a file

    Yes thankyou, that function and shFileExecute can do this but except those, there aren't any way else to make the file disapear forever. By forever I mean it will be unable to be brought back. I don't like the hafl-life method, one is to hit and another is to soothe. One shoot one life!

  4. #4
    Join Date
    Feb 2002
    Posts
    4,640

    Re: Delete a file

    As far as I know, DeleteFile does not move the file to the trash bin. It deletes it immediately (or when all handles to the file are closed).

    Viggy

  5. #5
    Join Date
    May 2009
    Posts
    7

    Re: Delete a file

    Around and around I still read the same information

  6. #6
    Join Date
    Aug 2008
    Posts
    902

    Re: Delete a file

    I still don't think we grasp your problem. Maybe if you explain yourself better.

    DeleteFile() does not move it trash. It removes the file from the file table(ie. same as Shift+Delete would in windows explorer.)

    If this isn't enough, and you need it to be deleted in a way in which undelete/data recovory programs cannot restore it, then simply open the file for writing to it, then for every byte in the file write a 0x00 and then follow up with a DeleteFile(). This way the file is removed from the table and the physical data has been overwritten.

  7. #7
    Join Date
    May 2009
    Location
    Netherlands
    Posts
    103

    Re: Delete a file

    To expand on what chris said.
    The file may still be recoverable by reading the magnetic history.
    The file may be overwritten in diffrent bit settings more than once.

    http://www.fileshredderpro.com/shred...lgorithms.html

    kudos please.


    Take a note tho. Doing this in SD cards is pointless and destroys the SD card!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured