Copies the character contents of a string to a local C string buffer after converting the characters to a given encoding.
- iOS 2.0+
- macOS 10.0+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
- watchOS 2.0+
- Core Foundation
The string whose contents you wish to access.
The C string buffer into which to copy the string. On return, the buffer contains the converted characters. If there is an error in conversion, the buffer contains only partial results.
The buffer must be large enough to contain the converted characters and a
NULterminator. For example, if the string is
Toby, the buffer must be at least 5 bytes long.
The length of
The string encoding to which the character contents of
theshould be converted. The encoding must specify an 8-bit encoding.
true upon success or
false if the conversion fails or the provided buffer is too small.
This function is useful when you need your own copy of a string’s character data as a C string. You also typically call it as a “backup” when a prior call to the
CFString function fails.