Contents

CFStringGetPascalString(_:_:_:_:)

Copies the character contents of a CFString object to a local Pascal string buffer after converting the characters to a requested encoding.

Declaration

func CFStringGetPascalString(_ theString: CFString!, _ buffer: StringPtr!, _ bufferSize: CFIndex, _ encoding: CFStringEncoding) -> Bool

Parameters

  • theString:

    The string to examine.

  • buffer:

    The Pascal string buffer into which to copy the theString. The buffer must be at least bufferSize bytes in length. On return, contains the converted characters. If there is an error in conversion, the buffer contains only partial results.

  • bufferSize:

    The length of the local buffer in bytes (accounting for the length byte).

  • encoding:

    The string encoding to which the character contents of theString should be converted.

Return Value

true if the operation succeeds or false if the conversion fails or the provided buffer is too small.

Discussion

This function is useful when you need your own copy of a CFString object’s character data as a Pascal string. You can also call it as a “backup” operation when a prior call to the CFStringGetPascalStringPtr(_:_:) function fails.

See Also

Accessing Characters