关于用二进制方式合并图片的问题
红色部分就是我不明白的地方
Private Sub MergeFile()
Dim strFileName1 As String '第一个文件
Dim strFileName2 As String '第二个文件
Dim strOutput As String '合并后的文件
Dim aryContent() As Byte '用来读取文件的数组,每次读取前要重定义
strFileName1 = "c:\a.bmp"
strFileName2 = "c:\b.bmp"
strOutput = "c:\out.bmp"
'注意下面三个Open语句都是用Binary模式打开的
Open strOutput For Binary As #100
Open strFileName1 For Binary As #1
Open strFileName2 For Binary As #2
Put #100, , LOF(1) '取得第一文件的长度,并把它写入到合并文件的文件头中
Put #100, , LOF(2) '取得第二文件的长度,并写入到合并文件的文件头中
ReDim aryContent(LOF(1) - 1) '重定义数组,为读取文件做准备请问这个重新定义数组为什么有个“-1”
Get #1, , aryContent() '取得第一文件的内容到数组
Put #100, , aryContent() '把第一文件的内容写到合并文件中
ReDim aryContent(LOF(2) - 1)
Get #2, , aryContent()
Put #100, , aryContent()
'关闭文件
Close #1
Close #2
Close #100
End Sub