Try this:
        FrmCustomAlert(ErrorAlert2,*temp, " ", " ");
instead of 
        FrmCustomAlert(ErrorAlert2, *temp, "", "");

Anthony Randazzo
Unwired Express - wireless that works for you
9101 Guilford Road
Columbia, MD 21046
301 498 3003 x3761 
301 498 6003 Fax

NOTICE:  This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged information.
Any unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.

To contact our email administrator directly, send to
[EMAIL PROTECTED]


-----Original Message-----
From: Sara Revell [mailto:[EMAIL PROTECTED]]
Sent: Thursday, June 21, 2001 11:36 AM
To: Palm Developer Forum
Subject: Database Help!


Hello,

I am having difficulties searching my database.  What I am trying to do
is
to read in co-ordinates from a GPS and compare them with co-ordinates in
a
databases.

Currently, all I am trying to do is get the X co-ordinate out of the
database (so that I can then convert it to an Integer and compare to my
co-ordinate) - right now, it should be a string.

My code compiles, but when it gets to the line
FrmCustomAlert(ErrorAlert2,
*temp, "", "");, it throws a memory error in POSE, saying that it is
accessing a memory location in low memory.  I have tried various
incarnations of the code below, and it has been looked at by someone
much
more proficient in C, than I am!  :)

Snippets of revelant code are below.

Any help would be greatly appreciated!

Sara

// Structure of the Database
typedef struct {
        Int32           mapID;
        const char *Xul;
        const char *Yul;
        const char *Xlr;
        const char *Ylr;
        const char *Bitmap;
} Map;

/***********************************************************************
 * FUNCTION:    InitializeMap
 * DESCRIPTION: Initializes the map database with sample co-ordinates
 * PARAMETERS:  none
 * RETURNED:    none
 * REVISION HISTORY: 
 
***********************************************************************/
static void InitializeMap(void)
{
        Map                     m1 = {1, "N55:56:59", "W3:12:21",
"N55:56:50", "W3:11:36", "BitmapTest1"};
        Map                     m2 = {2, "N55:57:06", "W3:11:38",
"N55:56:53", "W3:11:08", "BitmapTest2"};
        Map *map[2];
        UInt16  numMap = sizeof(map) / sizeof(map[0]);
        UInt16  i;
        
        MemHandle newRecordH;
        Map     *newRecordP;

        map[0] = &m1;
        map[1] = &m2;
        for (i = 0; i < numMap; i++) {
                UInt16  index = dmMaxRecordIndex;
                newRecordH = DmNewRecord(gLibDB, &index,
sizeof(map[i]));
                newRecordP = MemHandleLock(newRecordH);
                DmWrite(newRecordP, 0, &map[i], sizeof(map[i]));
                MemHandleUnlock(newRecordH);
                DmReleaseRecord(gLibDB, index, true);
        }
}


/***********************************************************************
 * FUNCTION:    SearchDB
 * DESCRIPTION: Searches the DB for and compares the co-ordinates
 * PARAMETERS:  db: the database to be searched
 * RETURNED:    boolean
 * REVISION HISTORY: 11/06/01: created
 *                      13/06/01: added loop
 
***********************************************************************/
static Boolean SearchDB(DmOpenRef db)
{
        UInt16    numRecords;
        Int16     index;
        MemHandle  h = NULL;
        Map *mapPointer, map;
        char *temp = NULL;
        FormPtr frm = FrmGetActiveForm();

        // If there are no records in the database, return false.
        numRecords = DmNumRecords(db);
        if (numRecords == 0){
                FrmAlert(ErrorAlert);
                return false;
        }

    for (index = 0; index < numRecords; index++){
                h = DmQueryRecord(db, index);
                mapPointer = MemHandleLock(h);
                map = *mapPointer;
                temp = (char *) map.Xul;
                FrmCustomAlert(ErrorAlert2, *temp, "", "");

                MemHandleUnlock(h);
                DmReleaseRecord(db, index, true);
        }
    return true;
}


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

--
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