I use this:
In the DB I have one UInt16, one Char * and a variable number of Char * (max 5)
using the static Char * makes that the pointers are still valid when the
function returns so you can use :
UInt16 id;
Char *preg;
Char *resp[5];
UInt8 mum;
GetPregunta(0,&id,&preg,resp,&num);
.... hope it helps..
Boolean GetPregunta(UInt16 index, UInt16 *pregID, Char **pregunta, Char
*respuestas[5], UInt8 *numAlternativas)
{
MemHandle recH;
const void *recP;
static Char *string;
UInt8 i;
ErrFatalDisplayIf(BdPreguntas==0,"GetPregunta(...): BdPreguntas
unInitialized");
recH=DmQueryRecord(BdPreguntas,index);
if(recH==NULL)
{
*pregID=0;
return true;
}
recP=MemHandleLock(recH);
*pregID=*(UInt16 *)recP;
string=(Char *)(recP+2);
*pregunta=string;
string+=StrLen(string)+1;
for(i=0;i<5;i++)
{
if(StrLen(string)==0)
break;
respuestas[i]=string;
string+= StrLen(string)+1;
}
MemHandleUnlock(recH);
return false;
}
At 11:58 02/04/01 -0700, you wrote:
>Thanx for this help Fox,
>
>Could you add to the reading part a bit though?
>
>For example, What kind of pointer should I be using to get to the strings.
>I need to first get past my struct which is at the beginning of the record
>to get to my strings.
Ingo Claro Fox
[EMAIL PROTECTED]
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/