[Plib-devel] ssg error message routines
Brought to you by:
sjbaker
From: Dave M. <dp...@ef...> - 2000-04-05 02:22:11
|
more info on the error routines I added: void ssgSetError ( const char* fmt, ... ) ; char* ssgGetError ( void ) ; void ssgClearError ( void ) ; Here are some examples of how an application might handle errors. If ErrorBox() shows a message to the user then to handle a fatal load error: ent = ssgLoad ( fname ) ; if ( ent == NULL ) { ErrorBox ( ssgGetError() ) ; } To handle all load error returns: ssgClearError(); ent = ssgLoad ( fname ) ; if ( ent == NULL ) { //fatal error ErrorBox ( ssgGetError() ) ; } else if ( strcmp(ssgGetError(), "") != 0 ) { //non-fatal errors ... still returned something ErrorBox ( ssgGetError() ) ; } PPE should probably do something like this. This is how it is done in SDL (Simple Direct Media Layer) and I would like to do it the same in SSG unless there are objections. To handle multiple error messages, the application could redirect stderr to a file or I could echo errors to a file in ssgSetError(). which do you prefer? -- Dave McClurg |