VB icon

A substitute 'FileCopy'

Email
Submitted on: 1/5/2015 5:35:00 AM
By: Im_[B]0ReD (from psc cd)  
Level: Intermediate
User Rating: By 7 Users
Compatibility: VB 5.0, VB 6.0
Views: 1879
 
     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.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: A substitute 'FileCopy'
' Description: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.
' By: Im_[B]0ReD (from psc cd)
'**************************************

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


Other 4 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.