VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This function manually copies files without using any command or api through opening the source-fil

by Peter Oberransmayr (1 Submission)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 21st May 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This function manually copies files without using any command or api through opening the source-file in binary mode and writing it to the

Rate This function manually copies files without using any command or api through opening the source-fil




Dim FileNr1 As Long
Dim FileNr2 As Long

'If file doesn't exist return nothing:
On Error Resume Next
If FileLen(SourcePath) = 0 Then Exit Function
On Error GoTo 0
  
'Read sourcefile
FileNr1 = FreeFile
Open SourcePath For Binary As #FileNr1
copyfile = Space$(LOF(FileNr1))
Get #FileNr1, , copyfile
Close #FileNr1
  
'Write destinationfile
FileNr2 = FreeFile
Open DestPath For Binary As #FileNr2
Put #FileNr2, , copyfile
Close #FileNr2

End Function


Download this snippet    Add to My Saved Code

This function manually copies files without using any command or api through opening the source-fil Comments

No comments have been posted about This function manually copies files without using any command or api through opening the source-fil. Why not be the first to post a comment about This function manually copies files without using any command or api through opening the source-fil.

Post your comment

Subject:
Message:
0/1000 characters