Hello,
I see a number of "obvious points":
- Are you sure that you use a stream pdb?
- Why do you open the file each time? (Nonsense from the efficiency point of
view.)
- If you open it, why don't you close it?
- Why do you seek to 0 after opening? (The position is already there.)
- Why do you seek to 0 at each call? You should continue where you left the
reading at the previous call.
- You do not return the actual size of bytes read.
The use of userDataP is strange. Can't you pass the handle to an opened file
here? (Or a more complex structure - it is up to you.)
Best regards,
Jan Slodicka
----- Original Message -----
From: "Tom" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Thursday, December 02, 2004 4:18 AM
Subject: Re: Send pdb as attachment
> Here is the code below .... What obvious point am I missing?
>
> static Err MyReadDBProc(void *bufBaseP, UInt32 *fileSize2,
> Char *userDataP)
> {
> Err err = errNone;
> FileHand *pFile;
> //FileRef fref = NULL;
> Int32 curpos = 0;
> Int32 numObj = 1;
>
> StrCat(userDataP, "_.pdb");
>
> pFile = FileOpen(0, userDataP, sysFileTFileStream,
> NULL, fileModeReadWrite, &err);
> if (err == errNone) {
> err = FileSeek(pFile, curpos, fileOriginBeginning);
> if (err == errNone) {
> FileRead(pFile, (void *)bufBaseP, numObj, (Int32)fileSize2, &err);
> }
> }
> return err;
> }
>
> main()
> {
> /* stuff deleted */
> err = ExgDBRead(MyReadDBProc, MyDelDBProc, attArray[i], idP,
> cardNo, needReset, keepDates);
> /* ..... */
> }
> --
> 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/