VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A substitute 'FileCopy'

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: (7 Votes)

i'd imagine this has been done before, but if it has i haven't seen it. all it is is a substitute for the FileCopy statement. copies a file byte-for-byte to a new destination. 110% commented just like 'A+ Secure Delete' And 'A "Dummy" File Generator' (both by me). well hope you like this.

Rate A substitute 'FileCopy'

Function CopyFile(srcFile As String, dstFile As String)
'this copies a file byte-for-byte
'or you could just use good old FileCopy :-)
On Error Resume Next 'If we get an error, keep going
Dim Copy As Long, CopyByteForByte As Byte 'the variables
Open srcFile For Binary Access Write As #1 'open the destination file so we can write to it
Open dstFile For Binary Access Read As #2 'open the source file so we can read from it
For Copy = 1 To LOF(2) 'Copy The SourceFile Byte-For-Byte
  Put #1, , CopyByteForByte 'Put the byte in the destination file
Next Copy 'stop the loop
MsgBox "Done!"
End Function

Download this snippet    Add to My Saved Code

A substitute 'FileCopy' Comments

No comments have been posted about A substitute 'FileCopy'. Why not be the first to post a comment about A substitute 'FileCopy'.

Post your comment

Subject:
Message:
0/1000 characters