aning
01-19-2005, 05:30 PM
'**************************************
' Name: *** Destroy a file without getti
' ng error! ***
' By: Matt Evans
'This code is copyrighted and has limite
' d warranties.
'Please see http://www.Planet-Source-Cod
' e.com/xq/ASP/txtCodeId.1650/lngWId.1/qx/
' vb/scripts/ShowCode.htm
'for details.
'**************************************
Sub DestroyFile(sFileName As String)
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 'wi
' pe-out' characters
Const BLOCKSIZE = 4096
Block1 = String(BLOCKSIZE, "X")
Block2 = String(BLOCKSIZE, " ")
'Overwrite the file contents with the wi
' pe-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 cont
' ains no sensitive data
Kill sFileName
End Sub
----------------------------------
I sure do know what the script does... but i just can't figure out how to make this code to work!! Can anyone get me the code! thank you... I'm learning VB since new weeks now and i guess its gonna take a long time for me... :p
' Name: *** Destroy a file without getti
' ng error! ***
' By: Matt Evans
'This code is copyrighted and has limite
' d warranties.
'Please see http://www.Planet-Source-Cod
' e.com/xq/ASP/txtCodeId.1650/lngWId.1/qx/
' vb/scripts/ShowCode.htm
'for details.
'**************************************
Sub DestroyFile(sFileName As String)
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 'wi
' pe-out' characters
Const BLOCKSIZE = 4096
Block1 = String(BLOCKSIZE, "X")
Block2 = String(BLOCKSIZE, " ")
'Overwrite the file contents with the wi
' pe-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 cont
' ains no sensitive data
Kill sFileName
End Sub
----------------------------------
I sure do know what the script does... but i just can't figure out how to make this code to work!! Can anyone get me the code! thank you... I'm learning VB since new weeks now and i guess its gonna take a long time for me... :p