Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Apr 2004
    Location
    Earth, located in Milky Way galaxy
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Help with this VB code

    '**************************************
    ' 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...
    You must dream to be a succesful person, go to sleep... www.niumai.tk is my site

  • #2
    Rockstar Coder
    Join Date
    Jun 2002
    Location
    USA
    Posts
    9,074
    Thanks
    1
    Thanked 328 Times in 324 Posts
    I didn't actually try the code but what doesn't work? Like what kind(s) of errors are you getting? Maybe post more code showing how you are using this code in your program.
    OracleGuy

  • #3
    New Coder
    Join Date
    Apr 2004
    Location
    Earth, located in Milky Way galaxy
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    oh thanx for the reply... i have finally made it to work but the code seems to work in the way i dont want it to...lol
    You must dream to be a succesful person, go to sleep... www.niumai.tk is my site


  •  

    Posting Permissions

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