(Unicode C++) Split File into Chunks
Demonstrates how to split a file into chunks.
#include <CkFileAccessW.h>
void ChilkatSample(void)
{
CkFileAccessW fac;
// Any type of file may be split. It doesn't matter if it's
// a binary file or a text file.
const wchar_t *fileToSplit = L"qa_data/hamlet.xml";
const wchar_t *partPrefix = L"hamlet";
const wchar_t *partExtension = L"part";
int maxChunkSize = 50000;
const wchar_t *destDirPath = L"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.
bool success = fac.SplitFile(fileToSplit,partPrefix,partExtension,maxChunkSize,destDirPath);
if (success == true) {
wprintf(L"Success.\n");
}
else {
wprintf(L"%s\n",fac.lastErrorText());
}
}
|