Hi,

Problem 1: Make sure you're not getting confused by deleted records.
Deleted records stay in the DB until the next sincronization, so the
total record count, and the 'live' record count may be different.

Problem 2: If you try to write to the record, in the Do Something here
section, you must use DmSet. Other than that, I guess your code is
correct.

Problem 3: Yes. A Memopad record is only a null terminated string. I've
successfully read from it, with no problems. The pointer obtained by the
record handle lock points to the first char. The best source of info
about the MemPad database is the application source code (headers,
mainly).

Sergio

Mike Davis wrote:

> I am having a problem understanding how to read and write
> a MemoPad record.
>
> I have looked at MemoPad application but is not really helping
> me on this.  I have three problems (probably more).
>
> Problem 1:  I have placed a Custom Alert to tell me how many
> records are in the DB.  The popup reports 535 records.  But
> there are only 144 records.  I have verified the real number of
> records by the count in MemoPad and by looking at the DB with
> RsrcEdit app.  Both show 144 records.  Why the discrepancy?
>
> Problem 2:  I get a fatal error when I use this code.  I have
> removed everything down to the bare minimum that causes the
> crash.  The problem is with what is inside the 'for' block.  I
> use this code to access another of my own DBs.  What is wrong
> with this code?  Why does it crash?
>
> Problem 3:  I have looked at the MemoDB with RsrcEdit and it is
> just a null terminated string for each record.  Doesn't RecPointer
> point to the first char of the MemoPad data?  If not, what is the
> format of the record pointed to by RecPointer?
>
> Where is the best source of documentation on a MemoPad record?
> A simple app would help.
>
> Thanks
>
> void GetImportNames(void) {
>     VoidHand    RecHandle;
>     Ptr         RecPointer;
>     int         i, numRecs;
>     char        buffer[10];
>
>     numRecs = DmNumRecords(ImportDB);
>         StrIToA(buffer, numRecs);
>         FrmCustomAlert(altNotice, buffer, "", "");
>
>     for(i=0; i<numRecs; i++) {      // get names
>         RecHandle = DmQueryRecord(ImportDB, i);
>         RecPointer = MemHandleLock(RecHandle);
>         // Do something here
>                 // to access specific data
>         MemPtrUnlock(RecPointer);
>     }
> }
> --
> -----------------------------------------------------------------
> Discussion Group:        http://www.halcyon.com/ipscone/wwwboard/
>
> Protect your constitutional rights. Your favorite one may be next!
> -----------------------------------------------------------------

--
Sergio Carvalho
---------------
[EMAIL PROTECTED]


Reply via email to