2004.05.25 08:07 "[Tiff] SetErrorHandler", by Jan-Harm Rienstra

2004.05.25 20:08 "Re: [Tiff] SetErrorHandler", by Frank Warmerdam

I've a question how to set the error handler (and warning handler too). I use a function "writeToLog(char * logStr)" for my application. And I want to submit the errors and warnings created by libtiff to the same logfile using my writeToLog function. (And suppress the popup error messages).

I've tried several possibilities with the SetErrorHandler function but I don't know exactly how to define the TIFFErrorHandler. Could anyone give some example code how to set the errorhandler to your "own function"

BTW, I use BCB 6 on a win XP platform

Jan,

I use:

/************************************************************************/
/*                        GTiffWarningHandler()                         */
/************************************************************************/
void
GTiffErrorHandler(const char* module, const char* fmt, va_list ap )
{
     char *pszModFmt;

     pszModFmt = PrepareTIFFErrorFormat( module, fmt );
     CPLErrorV( CE_Failure, CPLE_AppDefined, pszModFmt, ap );
     CPLFree( pszModFmt );
}

...
     TIFFSetErrorHandler( GTiffErrorHandler );
...

Best regards,

---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent