PalmOS 3.3

Hi,

My preference _pPrefs is a pointer to a structure of type

//===========================
typedef struct
 {
        UInt32 dwRecordId;
        Char   tcLandCode;
 } AppPreferenceType;
//===========================

allocated with operator new. It is stored as an app pref into saved
prefs like this

//=======================================
    PrefSetAppPreferences (_ulCid, _wPrefsId, _iVersion,
                           _pPrefs, _wPrefsSize, true);
//=======================================

where _wPrefsSize = sizeof( AppPreferenceType ).

Next runtime it is loaded into heap memory again:

//==========================================================
    if (PrefGetAppPreferences(_ulCid, _wPrefsId, _pPrefs, &_wPrefsSize,
true) ==
        noPreferenceFound) {
        _pPrefs->dwRecordId = 0;
        _pPrefs->tcLandCode = 0;
    }
//==========================================================

(the & is ok, a UInt16* is in accordance with the doc).

I would have expected, that _pPrefs had retained it's values from last
runtime. In fact it is nearly so:
*** The first 4 Bytes only are retained (dwRecordId), the second member
(tcLandCode) remains unitialized. ***

I can already observe, that _wPrefsSize, which is initially 6 before the
pref is written, is set 4 by PrefSetAppPreferences.
When I export the database from POSE and have a look on it, I can see,
that it ends after member dwRecordId,
tcLandCode seems not to have been stored.

I understood, that _pPrefs is a pointer to a buffer of a size, which is
not restricted to 4 bytes, is it?

Thank you very much in advance!


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to