(Visual FoxPro) Load Entire File into BinData
Demonstrates how to load an entire file into a BinData object.
LOCAL loFac
LOCAL lnSuccess
LOCAL loBd
LOCAL lnMaxBytesToRead
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.FileAccess')
loFac = CreateObject('Chilkat.FileAccess')
lnSuccess = loFac.OpenForRead("qa_data/pdf/sample.pdf")
IF (lnSuccess = 0) THEN
? loFac.LastErrorText
RELEASE loFac
CANCEL
ENDIF
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.BinData')
loBd = CreateObject('Chilkat.BinData')
lnMaxBytesToRead = 99999999
lnSuccess = loFac.FileReadBd(lnMaxBytesToRead,loBd)
IF (lnSuccess = 0) THEN
? loFac.LastErrorText
RELEASE loFac
RELEASE loBd
CANCEL
ENDIF
loFac.FileClose()
* The bd object contains the file data...
lnSuccess = loBd.WriteFile("qa_output/sample.pdf")
RELEASE loFac
RELEASE loBd
|