Hi Caspar,
> "Caspar Heiden, vd" <[EMAIL PROTECTED]> schrieb im
Newsbeitrag news:[EMAIL PROTECTED]
> I use
>
> error = VFSFileOpen (volRef, LOGFILENAME, vfsModeWrite | vfsModeCreate,
> &fileRef);
>
> this works fine, apart from the fact that I would like to open the file
> in 'append' - mode
If you want to append data to your file, you MUST use vfsModeReadWrite |
vfsModeCreate. Otherwise your file is deletetd every time it is open, so it
will only contain the latest block ao data.
- I want to add whatever I write to the file to the
> end of what is already in the file, and there is no Open Mode Constant
> to do this.
> So in order to find the end of the file (and to see if the filelength >
> 0), I try to retrieve the filesize. But
>
> error = VFSFileSize(fileRef, &fileSize);
>
> results in error A205 (vfsErrFilePermissionDenied - not listed in
> documentation as one of the potential errors for VFSFileSize)
> Permission denied????? Why?
I don't know. In my code this works perfect:
err = VFSFileOpen(volRefNum, theString, vfsModeReadWrite | vfsModeCreate,
&fileRef);
if (err) {
return err;
}
err = VFSFileSize(fileRef, &sizeCache);
if (err) {
return err;
}
So maybe it's the vfsModeWrite?
But, if you want to append your data, you could use this instead:
VFSFileSeek(fileRef, vfsOriginEnd, 0);
HostFS will return errNone, but on a real device you will get an
vfsErrFileEOF, so ignore this.
Good luck
Horst
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/