|
Уничтожение файла |
|
|
Уничтожение файла. Сначала файл заполняется информацией, а затем удаляется с помощью функции Kill.
Sub DestroyFile(sFileName As String)
Dim Block1 As String
Dim Block2 As String
Dim Blocks As Long
Dim hFileHandle As Integer
Dim i As Long
Dim offset As Long
Const BLOCKSIZE = 4096
Block1 = String(BLOCKSIZE, "X")
Block2 = String(BLOCKSIZE, " ")
hFileHandle = FreeFile
Open sFileName For Binary As hFileHandle
Blocks = (LOF(hFileHandle) \ BLOCKSIZE) + 1
For i = 1 To Blocks
offset = Seek(hFileHandle)
Put hFileHandle, , Block1
Put hFileHandle, offset, Block2
Next
Close hFileHandle
Kill sFileName
End Sub
|
|
|
|
|
|
|