English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
所有分類

我想要程式碼?可否給我範例並附上說明!感恩各位大大!
我當不慎感激!臨表哭泣!

2006-05-12 08:49:12 · 4 個解答 · 發問者 5 in 電腦與網際網路 程式設計

4 個解答

'表單放2CommandButtonPrivate Declare Sub RtlMoveMemory Lib "KERNEL32" (lpvDest As Any, lpvSource As Any, ByVal cbCopy As Long)Private Sub Command1_Click() '將檔案切割成兩個Dim S$, X&S = "C:\Test.exe" '欲切割檔案,別太大以免溢位X = FileLen(S)'建立兩個Byte陣列ReDim A(1 To X \ 2) As Byte, B(1 To X - X \ 2) As ByteOpen S For Binary As #1Get #1, , A '前半部讀入A陣列Get #1, X \ 2 + 1, B '後半部讀入B陣列Close #1'輸出A陣列為Test.exe1.rrrOpen "C:\Test.exe1.rrr" For Binary As #1Put #1, , AClose #1'輸出B陣列為Test.exe2.rrrOpen "C:\Test.exe2.rrr" For Binary As #1Put #1, , BClose #1MsgBox "分割完成,存放在" & vbCrLf & S & "1.rrr" & vbCrLf & S & "2.rrr"End SubPrivate Sub Command2_Click() '合併Dim Y&, I&, DD = Timer'建立兩個欲合併檔案Byte陣列ReDim A(1 To FileLen("C:\Test.exe1.rrr") + FileLen("C:\Test.exe2.rrr")) As Byte, B(1 To FileLen("C:\Test.exe2.rrr")) As Byte'讀入A陣列Open "C:\Test.exe1.rrr" For Binary As #1Get #1, , AClose #1'讀入B陣列Open "C:\Test.exe2.rrr" For Binary As #1Get #1, , BClose #1Y = FileLen("C:\Test.exe1.rrr") + 1'將B陣列合併到A陣列裡面(使用迴圈)For I = 1 To UBound(B)    A(Y) = B(I)    Y = Y + 1Next'使用迴圈來合併陣列若檔案很大時很費時,若使用RtlMoveMemory API函數就快多了'將上面的迴圈(紫色的地方)Mark掉,下面(紅色的地方)這行ReMark,比較一下會發覺時間差很多.'RtlMoveMemory A(Y), B(1), Len(B(1)) * UBound(B)'輸出A陣列為Test1.exeOpen "C:\Test1.exe" For Binary As #1Put #1, , AClose #1MsgBox "合併完成,存放在" & vbCrLf & "C:\Test1.exe" & vbCrLf & "共費時 : " & Timer - D & "秒"End Sub

2006-05-15 12:00:00 · answer #1 · answered by W.J.S. 7 · 0 0

就是切割檔案的程試碼!幫忙一下!

2006-05-15 04:54:42 · answer #2 · answered by 5 · 0 0

是什麼樣的程式碼,可以説清楚嗎?
你這樣沒辦法給你正確的程式碼

2006-05-14 21:41:01 · answer #3 · answered by 曉意 4 · 0 0

這題應該不難啊~問題是你要怎麼去切割...那才是重點
建議你去找MSDN的"Line Input # 陳述式",有你要的解答

2006-05-12 09:08:17 · answer #4 · answered by ? 5 · 0 0

fedest.com, questions and answers