the db name is always four chars... and i have the array named nomi as 32
this is the declaration:

typedef struct{
        char nomeDB[32];
} nomidb;
nomidb nomi[100];


----------------------------------------------------------------------------
-------------------


UInt16 InstalledDB(){

        Err err=0;
        DmSearchStateType stateInfo;
        LocalID dbID;
        UInt16 card;
        UInt32 wildcardCreator=appFileCreator;
        UInt16 i=0;
        Boolean newSearch=true;
        char nameP;
        UInt16 contChr;
        char *ptr;

        while (err==0) {
                err = DmGetNextDatabaseByTypeCreator(newSearch, &stateInfo,'DATA',
wildcardCreator,false, &card,&dbID);
                if (err==0){
                        instdb[i]=dbID;
                        DmDatabaseInfo (0,
instdb[i],&nameP,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
                        ptr = &nameP;
                        //metto il ciclo da 0 a 1 perch� deve prendere solo i primi 2 
car del
nome che identificano la provincia
                        //poi la funzione di scelta del DB gli attacca la stringa DB
                        for
(contChr=0;contChr<=1;contChr++){nomi[i].nomeDB[contChr]=ptr[contChr];}
                        i++;
                }
                newSearch=false;
        }
        if (i>15) i=15;
        return i;
}

if i use this function i get a BUS ERROR (read from a location 0x43444200,
causing bus error). If i make inactive the row "ptr = &nameP;" the program
works well, of course i can't get the db list. How i have to use this
function ? Where is the error?


-----Messaggio originale-----
Da: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] conto di Matthew
Henry
Inviato: marted� 14 ottobre 2003 17.21
A: Palm Developer Forum
Oggetto: Re: DmDatabaseInfo. How to use it?


You need to set up a buffer for the name.  I think you are trying to copy
the entire name into a single character.
There's a maximum name size in one of the headers.  I'm too lazy to look it
up, but you need to allocate your buffer that big.



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

Reply via email to