i get all what you said ,and do my program like bellow .but it doesn't work
well, i wonder if ther is some other mistaken ,please help!
record struct :
{
Uint32 id;
float hh;
char[10] info1;
char[20] info2;
} myrecord;
my section getting data:
char * pBuffer;
DWORD * temp,temp1;
pBuffer=(char *) rInfo.m_pBytes;
temp=(DWORD*)pBuffer;
temp1=*temp;
*(DWORD*)&temRec.id=SyncHHToHostDWord(temp1);// here i get id which is
dword
pBuffer+=sizeof(DWORD);
temp=(DWORD*)pBuffer;
temp1=*temp;
*(float*)&temRec.hh=SyncHHToHostDWord(temp1);// here i get hh which is
float pBuffer+=sizeof(float);
char *tt;
long re;
re=GetString( tt,pBuffer,strlen(pBuffer));
temRec.info1=tt; //here i get info1
pBuffer+=re;
re=GetString(tt,pBuffer,strlen(pBuffer));
temRec.info2=tt;// here i get info2
long GetString(char * pdest,char* psrc,int len) //my function of getting
string
{
int off=0;
while ((*psrc!='\0'))
{
*pdest=*psrc;
*pdes++;*psrc++;
off++;
}
*pdest='\0';
return strlen(pdest);
}
"Matt Graham" <[EMAIL PROTECTED]> ??????:[EMAIL PROTECTED]
>
> Ronnie van 't Westeinde wrote:
> > "jason" <[EMAIL PROTECTED]> write in news:107581@palm-dev-forum...
> >
> >>Hi:
> >> i want to know how to deal with the diferent data format while sync .
> >> i mean that when i use "SyncReadRecordByIndex(rInfo)" to get the
buffer
> >>where the palm data in .
> >>but how to get the real data.
> >> i know use below can get the UInt32:
> >>
> >> pBuffer=(char *) rInfo.m_pBytes;
> >> temp=(DWORD*)pBuffer;
> >> temp1=*temp;
> >> *(DWORD*)&temRec.rdata=SyncHHToHostDWord(temp1);
> >>
> >>how i can get another types, as float ,char and so on.
>
> > float not supported
>
> Floats are 32 bits just like longs. You should be able
> to do something like:
> float temp1;
> SyncHHToHostDWord( (DWORD *) &temp );
>
> For doubles, if you're using the ARM processor then
> the double should be fine as it is.
>
> Otherwise just reverse the order of the 8 bytes in
> the double.
>
> matt
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/