03-24-2012، 12:44 PM
با سورس کد زیر میتونید به سرعت فایلی رو کپی کنید در مقصد مورد نظرتون
Visual Basic is often seen as a tool to create front end GUI intensive applications. However, it can also easily be used to do lower level tasks such as quickly copying one file to another byte by byte. This code snippet demonstrates how you can easily take one file and copy it to a second one as quickly as possible. The way it does this is by pulling the whole file into memory and then writing it back out to the second file name.
This sample demonstrates some of VB's File IO operations such as Open, Get, and Put. It also demonstrates how you can declare a variable array and then change its size using the ReDim construct.
To implement this source code create a new VB6 program, add a button to the form, double click the button to get into its click event handler method, and add the following code within that method.
Visual Basic is often seen as a tool to create front end GUI intensive applications. However, it can also easily be used to do lower level tasks such as quickly copying one file to another byte by byte. This code snippet demonstrates how you can easily take one file and copy it to a second one as quickly as possible. The way it does this is by pulling the whole file into memory and then writing it back out to the second file name.
This sample demonstrates some of VB's File IO operations such as Open, Get, and Put. It also demonstrates how you can declare a variable array and then change its size using the ReDim construct.
To implement this source code create a new VB6 program, add a button to the form, double click the button to get into its click event handler method, and add the following code within that method.
کد:
Dim mByte() As Byte
Open "C:\Command.com" For Binary As #1
Open "C:\Backup.com" For Binary As #2
ReDim mByte(0 To LOF(1))
Get #1, , mByte()
Put #2, , mByte()
Close #1
Close #2
MsgBox "Done", vbInformation