Exiting

When your program is done, all it has to do is call exit(). You do not need to do any cleanup code for fltk. In particular you do not have to destroy any widgets you have created. Fltk also does not sneak any atexit functions in on you either. You will need to do #include <stdlib.h> to call exit().

If you don't do anything about it, fltk will call exit(0) when the user tries to close the last remaining window. On an SGI machine running 4DWM, it is possible to pick "Quit" off the window menu, and fltk will exit(0) in this case as well. If fltk detects an error (such as being unable to open the display or an unsupported visual) it will print a message and call exit(1).

You can override these behaviors with these functions:

void (*Fl::atclose)(Fl_Window*, void*);

void Fl::default_atclose(Fl_Window*, void*);

void (*Fl::warning)(const char*,...);
void (*Fl::error)(const char*,...);
void (*Fl::fatal)(const char*,...);