The return value of PrefGetAppPreferences is the *preference version
number*, NOT the size! In your example, the variable "s" is where the size
will be stored after the call. The value 2 in "prefsSize" is correct since
you probably stored version 2 of your preferences.

I would point out, however, that this is not documented (as far as I can
see) in the latest copy of the reference manual that I have. It says that
the routine returns "noPreferenceFound" if there are no preferences, but it
does not say what value it returns when successful. Also, the word "return"
is used in more than one context, which confuses things a bit.

  Doug Gordon
  GHCS Software


>From: "Marty Rice" <[EMAIL PROTECTED]>

>I initially thought the same thing but this is more precisely what I'm
>doing:

>typedef struct { ... } v1_PreferenceType; // global, 142 bytes total
>typedef struct { ... } v2_PreferenceType; // global, 228 bytes total

>In AppStart()...

>Word prefsSize, s=0;

>prefsSize = PrefGetAppPreferences(CRID,APPPREFID,NULL,&s,true);

>StrIToA(str1,prefsSize);
>StrIToA(str2,sizeof(v1_PreferenceType));
>StrIToA(str3,sizeof(v2_PreferenceType));

>The resulting display shows the three sizes to be 2, 142, and 228.



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palm.com/devzone/mailinglists.html

Reply via email to