在VBScript中将二进制文件的长度附加到自身

时间:2011-11-22 21:37:00

标签: vbscript

我试图找到一种方法将包含二进制文件长度的32位二进制数据附加到二进制文件的前面。以下是我到目前为止的情况:

Dim size, sizeStr, n
Dim byteArray

const adTypeText=2
const adTypeBinary=1

dim inStream, outStream

set inStream=WScript.CreateObject("ADODB.Stream")
set outStream=WScript.CreateObject("ADODB.Stream")

inStream.Open
inStream.type=adTypeBinary

outStream.Open
outStream.type=adTypeBinary

inStream.LoadFromFile("test.bin")
size = inStream.Size
'Converts a decimal value to a 32-bit binary string
sizeStr = DecimalToBinary(size)

outStream.Write sizeStr
outStream.Write = inStream.Read()

outStream.SaveToFile("output.bin")

outStream.Close()
inStream.Close()

如何将二进制字符串sizeStr转换为可以使用outStream.Write函数写出的表单?

0 个答案:

没有答案