CFStringGetPascalStringHeader: CFString.h

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

Boolean CFStringGetPascalString (
    CFStringRef theString, 
    StringPtr buffer, 
    CFIndex bufferSize, 
    CFStringEncoding encoding
);
theString

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

buffer

Pass a pointer to a Pascal 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.

bufferSize

Pass an integer specifying the length of the local buffer in bytes (accounting for the length byte).

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

TRUE if the operation succeeds or FALSE if the conversion fails or the provided buffer is too small.

DISCUSSION

The CFStringGetPascalString 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 CFStringGetPascalStringPtr fails.


© 1999 Apple Computer, Inc. — (Last Updated 9/15/99)