ctaGetText

Returns the text representation of an error, reason, event, or command code.

Prototype

DWORD ctaGetText ( CTAHD ctahd, unsigned code, char *buffer, unsigned size)

Argument

Description

ctahd

Context handle. Use a void context handle if the text is not associated with a context or a context is not available.

code

Natural Access code (either a general code or a code defined by a Natural Access service).

buffer

Pointer to a buffer to receive the text string. buffer should contain a minimum of 40 characters.

size

Size of buffer in bytes.


Return values

Return value

Description

SUCCESS

 

CTAERR_BAD_ARGUMENT

buffer is NULL.

CTAERR_BAD_SIZE

size is too small to receive the text.

CTAERR_INVALID_CTAHD

An invalid context handle was passed as an argument to a function, or the context was destroyed by another thread.

CTAERR_NOT_FOUND

Service to translate code is not found.

CTAERR_NOT_INITIALIZED

Natural Access is not initialized. Call ctaInitialize first.

CTAERR_SVR_COMM

Server communication error.


Details

ctaGetText returns a text string in buffer corresponding to the Natural Access error, reason, event, or command code.

Refer to Handling Natural Access errors for more information.

See also

ctaFormatEvent, ctaGetTextEx

Example

void DemoShowError( char *preface, DWORD errcode )
{
    char text[40];

    ctaGetText( NULL_CTAHD, errcode, text, sizeof(text) );
    printf( "\t%s: %s\n", preface, text );
}