CFStringGetCString |
||||
Header: | CFString.h | Carbon status: | Supported | |
Copies the character contents of a CFString object to a local C string buffer after converting the characters to a given encoding.
Boolean CFStringGetCString ( CFStringRef theString, char *buffer, CFIndex bufferSize, CFStringEncoding encoding );
Pass a reference to the CFString object whose contents you wish to access.
Pass a pointer to a C string buffer that you have allocated locally. The buffer must be at least bufferSize bytes in length. On return, the buffer contains the converted characters. If there is an error in conversion, the buffer contains only partial results.
Pass an integer specifying the length of the local buffer in bytes (accounting for the null-terminator byte).
Pass a constant of type CFStringEncoding that indentifies the encoding to which the character contents of the CFString object should be converted.
TRUE upon success or FALSE if the conversion fails or the provided buffer is too small.
The CFStringGetCString function is useful when you need your own copy of a CFString object's character data as a C string. You also typically call it as a "backup" when a prior call to CFStringGetCStringPtr fails.
Supported in Carbon. Available in Carbon 1.0.2 and later.
© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)