--- Christian <[EMAIL PROTECTED]> wrote:
>
> about a week ago Werner Poschenrieder described a problem he has
> using PrefSet/GetAppPreferences. I now have evidently the same:
>
> typedef struct prefs
> {
> Int16 connectionspeed;
> Int16 interface;
> Int16 keepalive;
> };
>
> prefs.interface = 1;
> prefs.connectionspeed = 2;
> prefs.keepalive = 3;
> prefsize = sizeof(prefs);
> PrefSetAppPreferences('PCRR', 0, 0x0014, &prefs, &prefsize, true);
This can't possibly be code that you have compiled.
1. prefs is a typedef; no space has been allocated for a variable.
2. the 5th parameter to PrefSetAppPreferences should be a UInt16, not a
pointer to whatever you declared prefsize to be.
What kind of compiler doesn't catch these errors?
>
> Calling PrefGetAppPreferences() and the program hasn't been
> restarted since saving, everything's fine.
> After exiting and reentering my app, PrefGetAppPreferences('PCRR', 0,
> &prefs, &prefsize, true) fills prefsize with 6 and so it looks good.
> But it only retreives the first two variables (so four bytes), not
> the third.
Well, since &prefsize is interpreted as a UInt16, it's not too
surprising that it doesn't contain the correct value.
__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/