Sample code for 30+ languages & platforms
Lianja

Split File into Chunks

Demonstrates how to split a file into chunks.

Chilkat Lianja Downloads

Lianja
llSuccess = .F.

loFac = createobject("CkFileAccess")

// Any type of file may be split.  It doesn't matter if it's
// a binary file or a text file.
lcFileToSplit = "qa_data/hamlet.xml"

lcPartPrefix = "hamlet"
lcPartExtension = "part"
lnMaxChunkSize = 50000
lcDestDirPath = "qa_output"

// Splits hamlet.xml into hamlet1.part, hamlet2.part, ...
// Output files are written to the current working directory.
// Each chunk will be 50000 bytes except for the last which
// will be the remainder.
llSuccess = loFac.SplitFile(lcFileToSplit,lcPartPrefix,lcPartExtension,lnMaxChunkSize,lcDestDirPath)

if (llSuccess = .T.) then
    ? "Success."
else
    ? loFac.LastErrorText
endif



release loFac