SCPreferencesSetSpecific Reference

Framework
Declared in
SCPreferencesSetSpecific.h

Overview

The functions in the SCPreferencesSetSpecific programming interface allow an application to set specific configuration information about the current system (for example, the computer or sharing name). Note that to access configuration preferences, you must first establish a preferences session using the SCPreferencesCreate function.

Functions

SCPreferencesSetComputerName

Sets the computer name preference to the specified name.

Boolean SCPreferencesSetComputerName (
   SCPreferencesRef prefs,
   CFStringRef name,
   CFStringEncoding nameEncoding
);
Parameters
prefs

The preferences session.

name

The computer name.

nameEncoding

The encoding associated with the computer name.

Return Value

TRUE if successful; otherwise, FALSE.

Discussion

To commit these changes to permanent storage you must call the SCPreferencesCommitChanges function. In addition, you must call the SCPreferencesApplyChanges function for the new name to become active.

Availability
  • Available in OS X v10.1 and later.
Declared In
SCPreferencesSetSpecific.h

SCPreferencesSetLocalHostName

Sets the local host name to the specified name.

Boolean SCPreferencesSetLocalHostName (
   SCPreferencesRef prefs,
   CFStringRef name
);
Parameters
prefs

The preferences session.

name

The local host name. This string must conform to the naming conventions of a DNS host name as specified in RFC 1034 (section 3.5).

Return Value

TRUE if successful; otherwise, FALSE.

Discussion

To commit these changes to permanent storage you must call the SCPreferencesCommitChanges function. In addition, you must call the SCPreferencesApplyChanges function for the new name to become active.

Availability
  • Available in OS X v10.2 and later.
Declared In
SCPreferencesSetSpecific.h