Carbon


TECConvertText

Header: TextEncodingConverter.h Carbon status: Supported

Converts a stream of text from a source encoding to a destination encoding. It uses the conversion path specified by the converter object you supply.

OSStatus TECConvertText (
    TECObjectRef encodingConverter, 
    ConstTextPtr inputBuffer, 
    ByteCount inputBufferLength, 
    ByteCount *actualInputLength, 
    TextPtr outputBuffer, 
    ByteCount outputBufferLength, 
    ByteCount *actualOutputLength
);
Parameter descriptions
encodingConverter

A reference to the text encoding converter object you want to use for the conversion. It can be a reference returned by the TECCreateConverter or TECCreateConverterFromPath functions.

inputBuffer

The stream of text you want to convert.

inputBufferLength

The length in bytes (UInt8 or unsigned char) of the stream of text.

actualInputLength

On return, a pointer to the number of source text bytes that were converted from the input buffer.

outputBuffer

A pointer to a buffer for a byte stream. On output, the buffer holds the converted text.

outputBufferLength

The length in bytes of the outputBuffer parameter.

actualOutputLength

On return, a pointer to the number of bytes of converted text returned in the outputBuffer parameter.

function result

A result code. If there is not enough memory available for TECConvertText to convert the text when allocating internal buffers, the function returns the appropriate Memory Manager result code.

DISCUSSION

If the output buffer you allocate is too small to accommodate any of the converted text, the function fails. For best results, you should follow these guidelines when you allocate an output buffer:

To make sure that you receive all of the converted text, you should call the function TECFlushText when you are finished converting all the text in a text stream.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 7/17/2000)