- Const adTypeBinary = 1
- Const adSaveCreateOverWrite = 2
-
- CopyBin "C:\boot.ini", "C:\boot.ini", "a.txt"
-
- Function CopyBin(File1, File2, DestFile)
- Dim ADOStrm
- Set ADOStrm = CreateObject("ADODB.Stream")
- ADOStrm.Type = adTypeBinary
- ADOStrm.Open
- ADOStrm.Write ReadBin(File1)
- ADOStrm.Write ReadBin(File2)
- ADOStrm.SaveToFile DestFile, adSaveCreateOverWrite
- End Function
-
- Function ReadBin(FileName)
- Dim ADOStrm
- Set ADOStrm = CreateObject("ADODB.Stream")
- ADOStrm.Type = adTypeBinary
- ADOStrm.Open
- ADOStrm.LoadFromFile FileName
- ReadBin = ADOStrm.Read
- End Function
复制代码
|