Mistake, that code won't quite work. This should:
tempData = Malloc(4096);
if (!tempData) {
cacheError(fileErrMemError);
return 2;
}
for (copied = 0; copied < size; copied += numBytesWrittenP) {
MemSet(tempData, 4096, 0);
readBytes = FileRead( cache, tempData, 4096, 1, &fileError);
if (fileError != errNone) {
cacheError(fileError);
loopError = true;
break;
}
err = VFSFileWrite(fileRefP, readBytes, tempData, &numBytesWrittenP);
if (err != errNone) {
VfsError(err);
loopError = true;
break;
}
}
if (tempData != NULL) Free(tempData);
tempData = NULL;
if (loopError == true) return 2;
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/