VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Destroy a file's information and than destroy the file.

by Matthew Gates (16 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Fri 25th February 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Destroy a file's information and than destroy the file.

Rate Destroy a file's information and than destroy the file.



    Dim Block1 As String, Block2 As String, Blocks As Long
    Dim hFileHandle As Integer, iLoop As Long, offset As Long
    'Create two buffers with a specified 'wipe-out' characters
    Const BLOCKSIZE = 4096
    Block1 = String(BLOCKSIZE, "X")
    Block2 = String(BLOCKSIZE, " ")
    'Overwrite the file contents with the wipe-out characters
    hFileHandle = FreeFile
    Open sFileName For Binary As hFileHandle
        Blocks = (LOF(hFileHandle) \ BLOCKSIZE) + 1
        For iLoop = 1 To Blocks
            offset = Seek(hFileHandle)
            Put hFileHandle, , Block1
            Put hFileHandle, offset, Block2
        Next iLoop
    Close hFileHandle
    'Now you can delete the file, which contains no sensitive data
    Kill sFileName
End Sub

Download this snippet    Add to My Saved Code

Destroy a file's information and than destroy the file. Comments

No comments have been posted about Destroy a file's information and than destroy the file.. Why not be the first to post a comment about Destroy a file's information and than destroy the file..

Post your comment

Subject:
Message:
0/1000 characters