Carbon


TECFlushText

Header: TextEncodingConverter.h Carbon status: Supported

Flushes out any data in a converter object’s temporary buffers and resets the converter object.

OSStatus TECFlushText (
    TECObjectRef encodingConverter, 
    TextPtr outputBuffer, 
    ByteCount outputBufferLength, 
    ByteCount *actualOutputLength
);
Parameter descriptions
encodingConverter

A reference to the text converter object whose contents are to be flushed. This can be a reference returned by the TECCreateConverter or TECCreateConverterFromPath functions.

outputBuffer

On return, a pointer to a buffer that holds the converted text.

outputBufferLength

The length in bytes of the buffer provided by the outputBuffer parameter.

actualOutputLength

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

function result

A result code.

DISCUSSION

You should always call TECFlushText when you finish converting a text stream. If you are converting a single stream in multiple chunks using multiple calls to TECConvertText, you only need to call TECFlushText after the last call to TECConvertText for that stream. The function uses the conversion path specified in the converter object you supply.

For the function to return successfully, the output buffer you allocate must be large enough to accommodate the flushed text. If the output buffer is too small to accommodate any flushed text, the function will fail. For best results, you should follow these guidelines when you allocate an output buffer:

Encodings such as ISO-2022 that need to shift back to a certain default state at the end of a conversion can do so when this function is called.

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)