Hi everybody,
I read PRC file or PBD file from my device that connects to Palm thru the serial port, 
put the
data in a file stream.
Before, I use the data manager functions create the database in Palm it works fine. I 
think I can
not use DmCreateDatabaseFromImage() because the database is to big (>64K) to fit in a 
buffer.
Now, I try to use ExgDBRead() to read data from a file stream to create a database in 
Palm and I
always get err = 259 (MemErrInvalidParam) return from ExgDBRead(). Please check for me 
to see what
I did wrong. For now, I delete the old DB before calling exgDBRead(), I do not use the
DeleteOldDB() call back function yet.
Thank you so much for any helps or suggestions on how to do this.

Tnn
// global variable
UIn32 totalBytesRead = 0;

/***********************************************************************/
/* FUNCTION:    ReadFromFile                                           */
/*                                                                     */
/* DESCRIPTION: Call back function for exchange manager function       */
/*              ExgDBRead to read data from file streaming, put in RAM */
/*                                                                     */
/* PARAMETERS:  dataP     - bufffer containing data to put in file     */
/*              sizeP     - number of bytes to put in file             */
/*              userDataP - application defined buffer for context     */
/*                          (holds exgSocket when using ExgManager     */
/*                                                                     */
/* RETURNED:    non_zero if error                                      */
/*                                                                     */
/* REVISION HISTORY:                                                   */
/*                                                                     */
/***********************************************************************/
static Err ReadFromFile(void* dataP, UInt32* sizeP, void* userDataP)
{
   Err err = 0;

   if (totalBytesRead) {
      if (*sizeP > totalBytesRead)
         *sizeP = totalBytesRead;
      FileRead((FileHand)userDataP, (void *)dataP,(Int32) *sizeP, 1,&err);
      ErrFatalDisplayIf(err," FileRead() error");
      totalBytesRead -= *sizeP;
   }
   return (err);
}

Err CopyDBToPalm(FileHand fileH,UInt32 size, Int16 whichCard)
{
   Err err;
   LocalID dbID;

   //...
   // delete the old db if there is one.

   totalBytesRead = size;
   err = ExgDBRead(ReadFromFile, DeleteOldDB,(void *)fileH, &dbID, (UInt16)whichCard, 
false,
true);
// err = 259 return from ExgDBRead()
   totalBytesRead = 0;
   //...
   //...
   return (err);
}


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to