Comment concaténer fichier binaire en utilisant ADODB.flux en VBscript
Salut les gars
je dois concaténer 3 fichier binaire dans un, mais je m obtenir une erreur alors que j'essaie ici, c'est mon code
' This is a simple example of managing binary files in
' vbscript using the ADODB object
dim inStream,outStream
const adTypeText=2
const adTypeBinary=1
' We can create the scream object directly, it does not
' need to be built from a record set or anything like that
set inStream=WScript.CreateObject("ADODB.Stream")
' We call open on the stream with no arguments. This makes
' the stream become an empty container which can be then
' used for what operations we want
inStream.Open
inStream.type=adTypeBinary
' Now we load a really BIG file. This should show if the object
' reads the whole file at once or just attaches to the file on
' disk
' You must change this path to something on your computer!
inStream.LoadFromFile(Zip7sSFX)
dim buff1
buff1 = inStream.Read()
inStream.LoadFromFile(Config)
dim buff2
buff2= inStream.Read()
inStream.LoadFromFile(PackName)
dim buff3
buff3= inStream.Read()
' Copy the dat over to a stream for outputting
set outStream=WScript.CreateObject("ADODB.Stream")
outStream.Open
outStream.type=adTypeBinary
dim buff
buff=buff1 & buff2 & buff3
' Write out to a file
outStream.Write(buff)
' You must change this path to something on your computer!
outStream.SaveToFile(OutputFile)
outStream.Close()
inStream.Close()
End Sub
Ce que je fais de mal, il se plaignent buff incompatibilité de type
merci
Jp
OriginalL'auteur jprbest | 2011-05-17
Vous devez vous connecter pour publier un commentaire.
Vous ne peut pas concaténer votre
buff
s avec&
comme ils sont(byte())Variants
, au lieu de cela vous pouvez ajouter le flux de sortie directement:outStream.Write inStream.Read
?L'affectation comme ça devrait fonctionner
est un appel de méthode, personnellement, j'écrirais l'ensemble de la ligne de cette façon
Call outStream.Write(inStream.Read())
.OriginalL'auteur Alex K.