Someone else suggested that you just need to add stuff to your
struct in even byte multiples.
For your case 2 solutions:
Add your Byte *after* the floats and ints and stuff
-or-
Add your Byte and right after it add another Byte, like so:
typedef struct
{
Byte myNewDataItem;
Byte unused; // this is needed so things belowe are aligned properly
float myfloat;
int myint;
char stringdata[1];
} PackedFoo;
----- Original Message -----
From: Tim Astle <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: Palm Developer Forum <[EMAIL PROTECTED]>
Sent: Monday, April 17, 2000 12:47 PM
Subject: Re: Weird.....
> Right on the money man. That was it. It's weird... probably both of you
> were right.
>
> When I added a type Byte or Boolean to my structure that I packed, it
caused
> my floats to mysteriously point to random pieces of memory. I searched
for
> achrieved messages on escribe, but I couldn't find what you were referring
> to.
>
> Would anyone happen to know the correct procedure to take when packing and
> unpacking a Byte / Boolean in a structure with other data?
>
> Thanks once again.
>
> --
>
> Tim Astle
>
>
>
> Haemish Graham <[EMAIL PROTECTED]> wrote in message
> news:8537@palm-dev-forum...
> >
> > [DELETIA]
> > >Okay, I had this function displaying float numbers in Exponential
format.
> > >However, now for some reason it displays nothing at first... then if I
> > click
> > >between the forms enough, it seems to display random bits and pieces of
> > >memory. (symbols, etc.)
> > >
> > >Does anyone have an idea? This just started happening after I modified
> my
> > >structures and added a new variable to them. (Byte) None of my other
> > >records have had problems in displaying, just these darned floats! :-)
> > Sounds like you are having word boundary problems with your struct. If
you
> > add a byte to a struct it may add more than 8 bits to the size of the
> > struct. This topic has been dealt with several times on this forum if
you
> > trawl through the archives, I think it also gets a mention in the
> o'reilly.
> >
> > -haemish
> >
> >
> >
> >
>
>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palm.com/devzone/mailinglists.html
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html