afSetErrorHandler man page on IRIX

Man page or keyword search:  
man Server   31559 pages
apropos Keyword Search (all sections)
Output format
IRIX logo
[printable version]



afSetErrorHandler(3dm)					afSetErrorHandler(3dm)

NAME
     afSetErrorHandler - supply an alternate error reporting routine to the
     Audio File Library

SYNOPSIS
     #include <dmedia/audiofile.h>

     AFerrfunc afSetErrorHandler(AFerrfunc efunc)

PARAMETER
     efunc	 is a pointer to an error handling routine which is declared
		 as:

		 void errorfunc(long, const char*)

RETURNED VALUE
     The returned value is a pointer to the previous error handling routine.

DESCRIPTION
     afSetErrorHandler() allows you to override the default error handling
     routine.

     The arguments that are passed to the error handling routine are an error
     code and a string containing a description of the error.

EXAMPLE
	 #include <dmedia/audiofile.h>
	 AFerrfunc defaultErrorHandler;
	 void silentAFerror(long errnum, const char* fmt)
	 {
	      /* suppress AF errors here */
	 }
	 ...
	      /* supply a new error handler */
	 defaultErrorHandler = afSetErrorHandler(silentAFerror);
	      /* AF errors won't be reported  here */
	 ...
	      /* restore the default error handler */
	 afSetErrorHandler(originalErrorHandler);
	      /* AF errors will be reported by the default error handler */
	 ...

CAVEATS
     The AF library error handler function pointer is declared as a global
     variable, and therefor is not safe for use in multi-threaded
     applications.  Specifically, a core dump may result if more than one
     thread attempts to use the error handler simultaneously.  This can be
     avoided by calling afSetErrorHandler(NULL) to disable the feature
     entirely.	The current version of the AF library has a MT-safe
     alternative to the AFerrorhandler:

									Page 1

afSetErrorHandler(3dm)					afSetErrorHandler(3dm)

     After disabling the internal error handler as shown above, an application
     should handle errors as in the example below:
     #include <dmedia/dmedia.h>

     AFfilehandle handle;

     handle = afOpenFile("some_filename", "r", NULL); /* attempt to open */

     if(handle == NULL) {
	 char detail[DM_MAX_ERROR_DETAIL]; /* storage for error detail */
	 int errorNumber;		   /* error token storage */
	 char *msg;			   /* short error message */
	 msg = dmGetError(&errorNumber, detail);
	 if(msg != NULL)		   /* if NULL, no error was reported */
	     fprintf(stderr, "%s [error number %d]\n", detail, errorNumber);

	 exit(1); /* or whatever */
     }
     The application must add -ldmedia to its link list if it calls
     dmGetError().  See dmGetError(3dm) for more details on this alternative.

SEE ALSO
     stdarg(5), afIntro(3dm), dmIntro(3dm), dmGetError(3dm)

									Page 2

[top]

List of man pages available for IRIX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net