AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
May 2004

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2004.05.25 08:07 "SetErrorHandler", by Jan-harm Rienstra
2004.05.25 20:08 "Re: SetErrorHandler", by Frank Warmerdam

2004.05.25 20:08 "Re: SetErrorHandler", by Frank Warmerdam

Rienstra, Jan-Harm wrote:
> Hi,
> 
> 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
> 
> Regards,
> 
> Jan Harm Rienstra
> _______________________________________________
> Tiff mailing list
> Tiff@remotesensing.org
> http://remotesensing.org/mailman/listinfo/tiff
> 

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