Sample code for 30+ languages & platforms
Lianja

Load Entire File into BinData

Demonstrates how to load an entire file into a BinData object.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

loFac = createobject("CkFileAccess")

llSuccess = loFac.OpenForRead("qa_data/pdf/sample.pdf")
if (llSuccess = .F.) then
    ? loFac.LastErrorText
    release loFac
    return
endif

loBd = createobject("CkBinData")
lnMaxBytesToRead = 99999999
llSuccess = loFac.FileReadBd(lnMaxBytesToRead,loBd)
if (llSuccess = .F.) then
    ? loFac.LastErrorText
    release loFac
    release loBd
    return
endif

loFac.FileClose()

// The bd object contains the file data...
llSuccess = loBd.WriteFile("qa_output/sample.pdf")


release loFac
release loBd