Contents

initWithCStringNoCopy

Initializes an immutable OSString to share the provided C string buffer.

Declaration

virtual bool initWithCStringNoCopy(
 const char *cString);

Parameters

  • cString:

    The C string to reference.

Return Value

true on success, false on failure.

Overview

Not for general use. Use the static instance creation method withCStringNoCopy instead.

An OSString object initialized with this function does not claim ownership of the C string, but shares it with the caller. When the caller determines that the OSString object has actually been freed, it can safely dispose of the data buffer. Conversely, if it frees the shared data buffer, it must not attempt to use the OSString object and should release it.

An OSString object created with this function does not allow changing the string via setChar.

See Also

Miscellaneous