Apple Network Setup Manual do Utilizador Página 39

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 184
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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);
Vista de página 38
1 2 ... 34 35 36 37 38 39 40 41 42 43 44 ... 183 184

Comentários a estes Manuais

Sem comentários