Hello,
just some observations to the code:
FileClose() call is missing; i.e. you probably open the DB multiple times.
Unnecessary testing FileEOF() in case of no error
Unnecessary call to FileTell() - the increment for pFile->curPos is known
from the FileRead() call.
By looking into Limited Palm OS sources, dmErrNotValidRecord (I hope you
meant this error code) is produced only in DmWriteCheck(), which is in turn
called from DmWrite() or DmSet(). Strange thing is that there should be an
alert. (I know, Palm OS 4 sources...)
With best regards,
Jan Slodicka
----- Original Message -----
From: "Bradly J. Barton" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Saturday, June 05, 2004 1:51 AM
Subject: ExgDBRead Trouble
> I am having trouble using ExgDBRead... When I make the call (below), the
> error that is returned is dmNotValidRecord:
>
> sTempFile file;
> file.fname = fname;
> file.curPos = 0;
> err = ExgDBRead(MyReadDBProc, MyDelDBProc, &file, pDBID, 0,
> &needReset, true);
>
> Here is the callback:
>
> static Err MyReadDBProc(void *dataP, UInt32 *sizeP, void *userDataP)
> {
> Err err = errNone;
> sTempFile *pFile = (sTempFile*) userDataP;
>
> FILE_REF frp = FileOpen(0, pFile->fname, sysFileTFileStream,
> dOnlineCreatorID, fileModeReadOnly, &err);
> if (err == errNone)
> {
> err = FileSeek(frp, pFile->curPos, fileOriginBeginning);
> if (err == errNone)
> {
> *sizeP = FileRead(frp, dataP, 1, (Int32) (*sizeP), &err);
> pFile->curPos = FileTell(frp, NULL, NULL);
> if (FileEOF(frp)) err = errNone;
> }
> }
> return err;
> }
>
> I can trace the first pass into the callback, and it appears to read the
> first 72 bytes of the stream (looks like the database header in
> memory).. and it returns from the callback with no error.
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/