Top |
A Glk program usually ends when the end of the glk_main()
function is
reached. You can also terminate it earlier.
void
glk_exit (void
);
If you want to shut down your program in the middle of your
function, you can call glk_main()
glk_exit()
.
This function does not return.
If you print some text to a window and then shut down your program, you can
assume that the player will be able to read it. Most likely the Glk library
will give a “Hit any key to exit
” prompt.
(There are other possiblities, however.
A terminal-window version of Glk might simply exit and leave the last screen
state visible in the terminal window.)
You should only shut down your program with glk_exit()
or by returning from
your
function. If you call the ANSI
glk_main()
function, bad things may happen. Some versions of
the Glk library may be designed for multiple sessions, for example, and you
would be cutting off all the sessions instead of just yours. You would
probably also prevent final text from being visible to the player.
exit()
Chimara
If there are any windows open at the time
glk_exit()
is called, then Chimara will leave them open. This way, the final text remains visible. Note that bad things most definitely will happen if you use the ANSI.
exit()