⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 err.cpp

📁 这是个人脸识别程序
💻 CPP
字号:
// $common\err.cpp 1.5 milbo$ error printing routines// Warning: this is raw research code -- expect it to be quite messy.// milbo durban dec05#include <windows.h>#include <io.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#include <signal.h>#include <float.h>#include <math.h>#include <new.h>#include <direct.h>#include <sys/stat.h>#include <fstream.h>#include <iostream.h>#include "mcommon.hpp"#include "util.hpp"#include "err.hpp"// fgErr is declared here merely for a clean link if err.cpp is linked in instead of werr.cppbool fgErr;		// Err or SysErr was invoked, needed under Windows because can't call exit()//-----------------------------------------------------------------------------// Print an warning message with standard "Warning" prefix// Using a standard format allows easy post processing of log file: grep for "Warning:"// This puts a \n on the msg so you shouldn't.void __cdecl Warn (const char *pArgs, ...)		// args like printf{va_list pArg;char *s = (char *)malloc(CONF_nMaxPrintfLen);va_start(pArg, pArgs);vsprintf(s, pArgs, pArg);va_end(pArg);lprintf("Warning: %s\n", s);//#if _DEBUG//	if (CONF_fAbortOnErr)//		EnterDebugger;//#endiffree(s);}//-----------------------------------------------------------------------------// Print an error message and exit.// This puts a \n on the msg so you shouldn't.void __cdecl Err (const char *pArgs, ...)		// args like printf{static bool fInHere;va_list 	pArg;if (fInHere)			// if already in here then just exit	printf("\nRecursive call to Err\n");else	{	fInHere = true;	char *s = (char *)malloc(CONF_nMaxPrintfLen);	va_start(pArg, pArgs);	vsprintf(s, pArgs, pArg);	va_end(pArg);	printf("\n%s\n", s);	fflush(stdout);					// unneeded under Win98 but needed under WinXP	logprintf("\nErr: %s\n", s);	// allows easy post processing of log file: grep for "Err:"#if _DEBUG	if (CONF_fAbortOnErr)		EnterDebugger;#endif	Shutdown();	free(s);	}exit(CONF_iErrExit);}//-----------------------------------------------------------------------------// Like Err but prepends SysErr: and is msg for that aren't directly caused// by the user i.e. for errors that should "never happen".// This puts a \n on the msg so you shouldn't.void __cdecl SysErr (const char *pArgs, ...)		// args like printf{static bool fInHere;va_list 	pArg;if (fInHere)			// if already in here then just exit	printf("\nRecursive call to SysErr\n");else	{	fInHere = true;	char *s = (char *)malloc(CONF_nMaxPrintfLen);	va_start(pArg, pArgs);	vsprintf(s, pArgs, pArg);	va_end(pArg);	lprintf("\nSysErr: %s\n", s);	fflush(stdout);					// unneeded under Win98 but needed under WinXP#if _DEBUG	if (CONF_fAbortOnErr)		EnterDebugger;#endif	Shutdown();	free(s);	}exit(CONF_iSysErrExit);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -