> ## Name

> cgGetNextProgram - iterate through programs in a context

> ## Synopsis

>     #include <Cg/cg.h>

>     CGprogram cgGetNextProgram( CGprogram program );

> ## Parameters

> program
>   The current program.

> ## Return Values

> Returns the next program in the context's internal sequence of programs.

> Returns NULL when program is the last program in the context.

> ## Description

> The programs within a context can be iterated over by using cgGetNextProgram.

> Note that no specific order of traversal is defined by this mechanism. The only guarantee is that each program will be visited exactly once. No guarantees can be made if programs are generated or deleted during iteration.

> ## Examples

>     CGprogram program = cgGetFirstProgram( context );
>     while( program )
>     {
>       /* do something with program */
>       program = cgGetNextProgram( program );
>     }

> ## Errors

> CG_INVALID_PROGRAM_HANDLE_ERROR is generated if program is not a valid program handle.

> ## History

> cgGetNextProgram was introduced in Cg 1.1.

> ## See Also

> cgGetFirstProgram, cgCreateProgram, cgDestroyProgram, cgIsProgram