You're storing the pointer to your data in the database. What you
want to do is store the data itself.
Also, in EffInitRecord (or is it InitRecord -- your source code shows
both), you're returning a pointer to a local variable. This is very
bad, since the data to which you're returning a pointer is reclaimed
(destroyed) once the Init function returns. Thus, returning data to
garbage.
-- Keith
>I have a record struct with three members in it. i.e: typedef MyStructType
> {
> char LineNo[5];
> char In[10];
> char Out[10];
> char Eff[3];
> }EffInfoType;
>
> typedef MyStructType
>* MyStructPtr;
>
>
> Since I'm not familiar with conduits i thought I'll initialise about 3
>stucture's and store it in the Palm database. So I could try retrieving them
>and get my logic right. But i dont seem to get the initialise records stored
>in the database.Can some one go through the code and let me know where I
>have gone wrong.
>
>
>
>-> Method to store the Sample data
>
>extern void SaveRecords(void)
>{
> MyStructPtr newPtr,MyRecordPtr;
> VoidHand textHandle;
> UInt index = 0,i=0;
>
> for (i = 0; i < 4; i++)
> {
>
> newPtr = InitRecord();
> textHandle = DmNewRecord(EffDB, &index, sizeof(newPtr));
>
> MyRecordPtr = MemHandleLock(textHandle);
>
> DmWrite(MyRecordPtr, 0, &newPtr, sizeof(newPtr));
>
> MemHandleUnlock(textHandle);
>
> DmReleaseRecord(EffDB, index, true);
> }
>}
>
>
>-> Code for IntRecord
>
>extern EffInfoPtr EffInitRecord(void)
>{
> MyStructType rec = {"line",
> "100000",
> "100000",
> "99"};
>
> return &rec;
>}
--
-- Keith Rollin
-- Palm OS Emulator engineer
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/