> ## Name

> cgGetLastListing - get the current listing text

> ## Synopsis

>     #include <Cg/cg.h>

>     const char * cgGetLastListing( CGcontext context );

> ## Parameters

> context
>   The context handle.

> ## Return Values

> Returns a null-terminated string containing the current listing text.

> Returns NULL if no listing text is available, or the listing text string is empty.

> In all cases, the pointer returned by cgGetLastListing is only guaranteed to be valid until the next Cg entry point not related to error reporting is called. For example, calls to cgCreateProgram, cgCompileProgram, cgCreateEffect, or cgValidateTechnique will invalidate any previously-returned listing pointer.

> ## Description

> Each Cg context maintains a null-terminated string containing warning and error messages generated by the Cg compiler, state managers and the like. cgGetLastListing allows applications and custom state managers to query the listing text.

> cgGetLastListing returns the currrent listing string for the given CGcontext. When a Cg runtime error occurs, applications can use the listing text from the appropriate context to provide the user with detailed information about the error.

> ## Examples

> to-be-written

> ## Errors

> CG_INVALID_CONTEXT_HANDLE_ERROR is generated if context is not a valid context.

> ## History

> cgGetLastListing was introduced in Cg 1.1.

> ## See Also

> cgSetLastListing, cgCreateContext, cgSetErrorHandler