VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A 'Dummy' File Generator

by Im_[B]0ReD (5 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

generates a 'dummy' file which can be any type and any number of kilobytes. 110% commented just like my code 'A+ Secure Delete'. purpose is to generate files, so not much of a purpose. i just saw it in a couple of hacking/security programs and thought i'd try it.

Rate A 'Dummy' File Generator

Function GenerateDummyFile(Path As String, LengthInKB As Long)
'This function is used to Generate A "Dummy File"
'(it's a file that's only purpose is to do absolutely
'nothing).
On Error Resume Next 'If we get an error, keep going
Dim GeneratedByte As Byte, Generate As Integer 'the variables
Open Path For Binary Access Write As #1 'Open the "Dummy Path" so we can write to it
For Generate = 1 To LengthInKB * 1024 'this is the loop to that does 2 things...
'1) goes from 1 to the length in KiloBytes (to add to the file)
'2) converts bytes to KiloBytes By Multiplying The Size in KB * 1024 (the size of on KB in bytes)
  Put #1, , GeneratedByte 'put the generated byte into the "Dummy File"
Next Generate 'stop the loop
MsgBox "Done!"
End Function

Download this snippet    Add to My Saved Code

A 'Dummy' File Generator Comments

No comments have been posted about A 'Dummy' File Generator. Why not be the first to post a comment about A 'Dummy' File Generator.

Post your comment

Subject:
Message:
0/1000 characters