Otcfgsetprefs – Apple Network Setup User Manual

Page 87

Advertising
background image

C H A P T E R 3

Network Setup Reference

Network Setup Functions

87

DISCUSSION

The

OTCfgGetPrefs

function gets the value of the preference specified by

prefsType

in the entity represented by

accessID

and stores it in

data

.

Before calling

OTCfgGetPrefs

, you may call

OTCfgGetPrefsSize

(page 85) to

obtain the size of the entity so that you can allocate a

data

parameter of the

appropriate size.

If the

data

parameter is too small to hold the value,

OTCfgGetPrefs

stores as

much of the value in

data

as possible and returns the error

kCFGErrDataTruncated

.

OTCfgSetPrefs

3

Sets the value of a preference.

OSStatus OTCCfgSetPrefs (CfgEntityAccessID accessID.

OSType prefsType,

const void* data,

ByteCount length);

accessID

On input, a value of type

CfgEntityAccessID

(page 100),

obtained by previously calling

OTCfgOpenPrefs

(page 84). The

entity in which the preference represented by

accessID

resides

must itself reside in an area that has been opened for writing by
calling

OTCfgBeginAreaModifications

(page 63).

prefsType

On input, a value of type

OSType

that identifies the preference to

set. If a preference of the type specified by

prefsType

already

exists

OTCfgSetPrefs

overwrites the value of the preference.

Otherwise,

OTCfgSetPrefs

creates the new preference.

data

On input, a pointer to the data that is to be set.

length

On input, a value of type

ByteCount

that contains the length in

bytes of the data in

data

.

function result A value of

noErr

indicates that

OTCfgSetPrefs

returned

successfully. For a list of other possible result codes, see “Result
Codes” (page 110).

Advertising