CFStringGetCStringPtr

Header: CFString.h Carbon status: Supported

Quickly obtains a pointer to a C-string buffer containing the characters of a CFString object in a given encoding.

const char *CFStringGetCStringPtr (
    CFStringRef theString, 
    CFStringEncoding encoding
);
Parameter descriptions
theString

Pass a reference to the CFString object whose contents you wish to access.

encoding

Pass a constant of type CFStringEncoding that indentifies the encoding to which the character contents of the CFString object should be converted.

function result

A pointer to a C string or NULL if the internal storage of the CFString does not allow this to be returned efficiently.

DISCUSSION

This function either returns the requested pointer immediately, with no memory allocations and no copying, in constant time, or returns NULL. If the latter is the result, call an alternative function such as CFStringGetCString function to extract the characters.

Whether or not this function returns a valid pointer or NULL depends on many factors, all of which depend on how the string was created and its properties. In addition, the function result might change between different releases and on different platforms. So do not count on receiving a non-NULL result from this function under any circumstances.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)