(VBScript) Load Entire File into BinData
Demonstrates how to load an entire file into a BinData object.
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.FileAccess")
set fac = CreateObject("Chilkat.FileAccess")
success = fac.OpenForRead("qa_data/pdf/sample.pdf")
If (success = 0) Then
outFile.WriteLine(fac.LastErrorText)
WScript.Quit
End If
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.BinData")
set bd = CreateObject("Chilkat.BinData")
maxBytesToRead = 99999999
success = fac.FileReadBd(maxBytesToRead,bd)
If (success = 0) Then
outFile.WriteLine(fac.LastErrorText)
WScript.Quit
End If
fac.FileClose
' The bd object contains the file data...
success = bd.WriteFile("qa_output/sample.pdf")
outFile.Close
|