![]() |
CFStringCreateWithBytes | Header: CFString.h |
Creates a CFString object from a buffer containing characters in a specified encoding.
CFStringRef CFStringCreateWithBytes ( CFAllocatorRef alloc, const UInt8 *bytes, CFIndex numBytes, CFStringEncoding encoding, Boolean isExternalRepresentation );
Pass a reference to an allocator object to be used for the CFString object or pass NULL to request the default allocator.
Pass a pointer to a buffer containing the characters in the specified encoding.
Pass an integer specifying the number of bytes in the buffer.
Pass an enum constant of type CFStringEncoding to specify the encoding of the characters in the buffer.
Pass true if the characters in the byte buffer are in an "external representation" formatthat is, whether the buffer contains a BOM (byte order marker) and so whether byte swapping must take place. This is usually the case for bytes that are read in from a text file or received over the network. Otherwise, pass false.
A reference to an immutable CFString object or NULL if there was a problem creating the object.
The CFStringCreateWithBytes function creates an immutable CFString object from a "raw" byte bufferthat is, a buffer containing 8-bit characters but no length byte (as in Pascal buffers) and no terminating NULL character (as in C buffers). The number of bytes in the buffer is provided in a parameter. The characters in the buffer should be in an 8-bit encoding; you specify this encoding in another parameter. This function handles character data in an "external representation" format by interpreting any BOM (byte order marker) character and performing any necessary byte swapping.