Для Qt 3.3.7:
void qFatal( const char *msg, ... )
{
char buf[QT_BUFFER_LENGTH];
va_list ap;
va_start( ap, msg ); // use variable arg list
#if defined(QT_VSNPRINTF)
QT_VSNPRINTF( buf, QT_BUFFER_LENGTH, msg, ap );
#else
vsprintf( buf, msg, ap );
#endif
va_end( ap );
if ( handler ) {
(*handler)( QtFatalMsg, buf );
} else {
#if defined(Q_CC_MWERKS)
mac_default_handler(buf);
#else
fprintf( stderr, "%s\n", buf ); // add newline
#endif
#if defined(Q_OS_UNIX) && defined(QT_DEBUG)
abort(); // trap; generates core dump
#elif defined(Q_OS_TEMP) && defined(QT_DEBUG)
QString fstr;
fstr.sprintf( "%s:%s %s %s\n", __FILE__, __LINE__, QT_VERSION_STR, buf );
OutputDebugString( fstr.ucs2() );
#elif defined(_CRT_ERROR) && defined(_DEBUG)
_CrtDbgReport( _CRT_ERROR, __FILE__, __LINE__, QT_VERSION_STR, buf );
#else
exit( 1 ); // goodbye cruel world
#endif
}
}
Для Qt 4.2.2:
void qFatal(const char *msg, ...)
{
char buf[QT_BUFFER_LENGTH];
buf[QT_BUFFER_LENGTH - 1] = '\0';
va_list ap;
va_start(ap, msg); // use variable arg list
qvsnprintf(buf, QT_BUFFER_LENGTH - 1, msg, ap);
va_end(ap);
qt_message_output(QtFatalMsg, buf);
}
[/code]