Apple Network Setup Bedienungsanleitung Seite 39

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 184
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 38
CHAPTER 2
Using Network Setup
Reading and Writing Preferences 39
}
return err;
}
Writing Preferences 2
Listing 2-11 shows the routine MyWritePref, which demonstrates the basic
mechanism for writing preferences. Writing a preference is similar to reading a
preference, with the following exceptions:
When you open the entity, open the entity for writing by passing true in the
writer parameter of OTCfgOpenPrefs.
The entity that is opened must be in a writable temporary area. Attempting
to open for writing an entity in a read-only area will result in an error.
Note
You don’t need provide the area identifier when you call
OTCfgOpenPrefs because an entity “knows” the area to
which it belongs.
Listing 2-11 Writing a preference
static OSStatus MyWritePref(CfgDatabaseRef dbRef,
const CfgEntityRef *entity,
OSType prefType,
const void *buffer,
ByteCount bufferSize)
{
OSStatus err;
OSStatus err2;
CfgEntityAccessID accessID;
assert(dbRef != nil);
assert(entity != nil);
assert(buffer != nil);
err = OTCfgOpenPrefs(dbRef, entity, true, &accessID);
if (err == noErr) {
err = OTCfgSetPrefs(accessID, prefType, buffer, bufferSize);
Seitenansicht 38
1 2 ... 34 35 36 37 38 39 40 41 42 43 44 ... 183 184

Kommentare zu diesen Handbüchern

Keine Kommentare