当前位置: 首页>>代码示例>>C++>>正文


C++ Sys_Print函数代码示例

本文整理汇总了C++中Sys_Print函数的典型用法代码示例。如果您正苦于以下问题:C++ Sys_Print函数的具体用法?C++ Sys_Print怎么用?C++ Sys_Print使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Sys_Print函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Com_Error

void Com_Error(bool exit, const char* format, ...)
{
	static char buffer[32768] = { 0 };

	va_list va;
	va_start(va, format);

	//vprintf(format, va);
	_vsnprintf(buffer, sizeof(buffer), format, va);
	va_end(va);

	if (console){
		Sys_Print("^1ERROR: ");
		Sys_Print(buffer);
		Sys_Print("^7\n");
	}
	else {
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
		printf("ERROR: %s\n", buffer);
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
	}

	if (exit)
	{
		if (IsDebuggerPresent())
		{
			DebugBreak();
		}
		TerminateProcess(GetCurrentProcess(), -1);
	}
}
开发者ID:FreeTheTech101,项目名称:zonebuilder,代码行数:31,代码来源:Util.cpp

示例2: MsgDev

/*
================
MsgDev

formatted developer message
================
*/
void MsgDev( int level, const char *pMsg, ... )
{
	va_list	argptr;
	char	text[8192];

	if( host.developer < level ) return;

	va_start( argptr, pMsg );
	Q_vsnprintf( text, sizeof( text ), pMsg, argptr );
	va_end( argptr );

	switch( level )
	{
	case D_WARN:
		Sys_Print( va( "^3Warning:^7 %s", text ));
		break;
	case D_ERROR:
		Sys_Print( va( "^1Error:^7 %s", text ));
		break;
	case D_INFO:
	case D_NOTE:
	case D_AICONSOLE:
		Sys_Print( text );
		break;
	}
}
开发者ID:Tox86,项目名称:xash3d,代码行数:33,代码来源:sys_win.c

示例3: Cmd_Echo_f

/*
===============
Cmd_Echo_f

Just prints the rest of the line to the console
===============
*/
void Cmd_Echo_f( void )
{
	int	i;
	
	for( i = 1; i < Cmd_Argc(); i++ )
		Sys_Print( Cmd_Argv( i ));
	Sys_Print( "\n" );
}
开发者ID:gitter-badger,项目名称:xash3d,代码行数:15,代码来源:cmd.c

示例4: Sys_ErrorDialog

/*
==============
Sys_ErrorDialog

Display an error message
==============
*/
void Sys_ErrorDialog( const char *error )
{
	char buffer[ 1024 ];
	unsigned int size;
	fileHandle_t f;
	const char *fileName = "crashlog.txt";

	// Shut down now so that the curses console doesn't clear the screen when it's really shut down
	CON_Shutdown( );

	Sys_Print( va( "%s\n", error ) );

	// Write console log to file and to stderr
	f = FS_SV_FOpenFileWrite( fileName );
	if( !f )
	{
		Com_Printf( "ERROR: couldn't open %s\n", fileName );
		return;
	}

	while( ( size = CON_LogRead( buffer, sizeof( buffer ) ) ) > 0 )
	{
		FS_Write( buffer, size, f );
		fputs( buffer, stderr );
	}

	FS_FCloseFile( f );
}
开发者ID:shawnd,项目名称:urt-bumpy-engine,代码行数:35,代码来源:sys_unix.c

示例5: Sys_Error

/*
=============
Sys_Error

A raw string should NEVER be passed as fmt, because of "%f" type crashers.
=============
*/
__cdecl void QDECL Sys_Error( const char *fmt, ... ) {

	FILE * fdout;
	char* fileout = "sys_error.txt";
	va_list		argptr;
	char		msg[MAXPRINTMSG];
	char		buffer[MAXPRINTMSG];

	va_start (argptr,fmt);
	Q_vsnprintf (msg, sizeof(msg), fmt, argptr);
	va_end (argptr);

	Com_sprintf(buffer, sizeof(buffer), "\nSys_Error: %s\n", msg);

	//Print the error to our console
	Sys_Print( buffer );

	//Try to write the error into a file
	fdout=fopen(fileout, "w");
	if(fdout){
		fwrite(buffer, strlen(buffer), 1 ,fdout);
		fclose(fdout);
	}

	Sys_WaitForErrorConfirmation( msg );

	Sys_Exit( 1 ); // bk010104 - use single exit point.
}
开发者ID:Call-of-Duty-Scripts,项目名称:CoD4x1.8_Server_Pub,代码行数:35,代码来源:sys_main.c

示例6: Win_PrintMatches

static void Win_PrintMatches(const char *s)
{
	if(!Q_stricmpn(s, win_currentMatch, win_acLength))
	{
		Sys_Print(va("  ^9%s^0\n", s));
	}
}
开发者ID:ethr,项目名称:ETXrealPro,代码行数:7,代码来源:win_syscon.c

示例7: Sys_Break

/*
================
Sys_Break

same as Error
================
*/
void Sys_Break( const char *error, ... )
{
	va_list		argptr;
	char		text[MAX_SYSPATH];

	if( host.state == HOST_ERR_FATAL )
		return; // don't multiple executes

	error_on_exit = true;	
	host.state = HOST_ERR_FATAL;         
	va_start( argptr, error );
	Q_vsprintf( text, error, argptr );
	va_end( argptr );

	if( host.type == HOST_NORMAL )
	{
		if( host.hWnd ) ShowWindow( host.hWnd, SW_HIDE );
		VID_RestoreGamma();
	}

	if( host.type != HOST_NORMAL || host.developer > 0 )
	{
		Con_ShowConsole( true );
		Con_DisableInput();	// disable input line for dedicated server
		Sys_Print( text );
		Sys_WaitForQuit();
	}
	else
	{
		Con_ShowConsole( false );
		MSGBOX( text );
	}
	Sys_Quit();
}
开发者ID:bmk10,项目名称:sing-engine,代码行数:41,代码来源:sys_win.c

示例8: Win_PrintCvarMatches

// ydnar: to display cvar values
static void Win_PrintCvarMatches(const char *s)
{
	if(!Q_stricmpn(s, win_currentMatch, win_acLength))
	{
		Sys_Print(va("  ^9%s = ^5%s^0\n", s, Cvar_VariableString(s)));
	}
}
开发者ID:ethr,项目名称:ETXrealPro,代码行数:8,代码来源:win_syscon.c

示例9: InputLineWndProc

LONG WINAPI InputLineWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
	char inputBuffer[1024];

	switch ( uMsg )
	{
	case WM_KILLFOCUS:
		if ( ( HWND ) wParam == s_wcd.hWnd ||
			 ( HWND ) wParam == s_wcd.hwndErrorBox )
		{
			SetFocus( hWnd );
			return 0;
		}
		break;

	case WM_CHAR:
		if ( wParam == 13 )
		{
			GetWindowText( s_wcd.hwndInputLine, inputBuffer, sizeof( inputBuffer ) );
			strncat( s_wcd.consoleText, inputBuffer, sizeof( s_wcd.consoleText ) - strlen( s_wcd.consoleText ) - 5 );
			strcat( s_wcd.consoleText, "\n" );
			SetWindowText( s_wcd.hwndInputLine, "" );

			Sys_Print( va( "]%s\n", inputBuffer ) );

			return 0;
		}
	}

	return CallWindowProc( s_wcd.SysInputLineWndProc, hWnd, uMsg, wParam, lParam );
}
开发者ID:themuffinator,项目名称:fnq3,代码行数:31,代码来源:win_syscon.c

示例10: Sys_ErrorDialog

/**
 * @brief Displays an error message and writes the error into crashlog.txt
 * @param[in] error Error String
 */
void Sys_ErrorDialog(const char *error)
{
	char         buffer[1024];
	unsigned int size;
	int          f         = -1;
	const char   *homepath = Cvar_VariableString("fs_homepath");
	const char   *gamedir  = Cvar_VariableString("fs_gamedir");
	const char   *fileName = "crashlog.txt";
	char         *dirpath  = FS_BuildOSPath(homepath, gamedir, "");
	char         *ospath   = FS_BuildOSPath(homepath, gamedir, fileName);

	Sys_Print(va("%s\n", error));

#ifndef DEDICATED
	// We may have grabbed input devices. Need to release.
	if (SDL_WasInit(SDL_INIT_VIDEO))
	{
		SDL_WM_GrabInput(SDL_GRAB_OFF);
	}

	Sys_Dialog(DT_ERROR, va("%s\nSee \"%s\" for details.\n", error, ospath), "Error");
#endif

	// Make sure the write path for the crashlog exists...
	// check homepath
	if (!Sys_Mkdir(homepath))
	{
		Com_Printf("ERROR: couldn't create path '%s' to write file '%s'.\n", homepath, ospath);
		return;
	}
	// check gamedir (inside homepath)
	if (!Sys_Mkdir(dirpath))
	{
		Com_Printf("ERROR: couldn't create path '%s' to write file '%s'.\n", dirpath, ospath);
		return;
	}

	// We might be crashing because we maxed out the Quake MAX_FILE_HANDLES,
	// which will come through here, so we don't want to recurse forever by
	// calling FS_FOpenFileWrite()...use the Unix system APIs instead.
	f = open(ospath, O_CREAT | O_TRUNC | O_WRONLY, 0640);
	if (f == -1)
	{
		Com_Printf("ERROR: couldn't open '%s'\n", fileName);
		return;
	}

	// We're crashing, so we don't care much if write() or close() fails.
	while ((size = CON_LogRead(buffer, sizeof(buffer))) > 0)
	{
		if (write(f, buffer, size) != size)
		{
			Com_Printf("ERROR: couldn't fully write to '%s'\n", fileName);
			break;
		}
	}

	close(f);
}
开发者ID:scenna,项目名称:etlegacy,代码行数:63,代码来源:sys_unix.c

示例11: Sys_Error

/*
=================
Sys_Error
=================
*/
void Sys_Error( const char *error, ... ) {
	va_list argptr;
	char    string[4096];
#if defined (_WIN32) && !defined (_DEBUG)
	MSG		msg;
#endif

	va_start (argptr,error);
	idStr::vsnPrintf (string, sizeof(string), error, argptr);
	va_end (argptr);

#if defined (_WIN32) && !defined (_DEBUG)
	Conbuf_AppendText( string );
	Conbuf_AppendText( "\n" );
#else
	// Print text in the console window/box
	Sys_Print( string );
	Sys_Print( "\n" );
#endif

#if defined (_WIN32) && !defined (_DEBUG)
	Sys_SetErrorText( string );
	Sys_ShowConsole( 1, qtrue );

	timeEndPeriod( 1 );

	IN_Shutdown();

	// wait for the user to quit
	while ( 1 ) {
		if ( !GetMessage( &msg, NULL, 0, 0 ) ) {
			Com_Quit_f();
		}
		TranslateMessage( &msg );
		DispatchMessage( &msg );
	}

	Sys_DestroyConsole();
#endif

	CL_Shutdown( );
	Sys_ErrorDialog( string );

	Sys_Exit( 1 );
}
开发者ID:DerSaidin,项目名称:OpenWolf,代码行数:50,代码来源:sys_main.cpp

示例12: Msg

/*
================
Msg

formatted message
================
*/
void Msg( const char *pMsg, ... )
{
	va_list	argptr;
	char	text[8192];
	
	va_start( argptr, pMsg );
	Q_vsnprintf( text, sizeof( text ), pMsg, argptr );
	va_end( argptr );

	Sys_Print( text );
}
开发者ID:Tox86,项目名称:xash3d,代码行数:18,代码来源:sys_win.c

示例13: Com_PrintMessage

__cdecl void Com_PrintMessage( int dumbIWvar, char *msg, msgtype_t type) {

	//secures calls to Com_PrintMessage from recursion while redirect printing
	static qboolean lock = qfalse;

	if(dumbIWvar == 6) return;

	int msglen = strlen(msg);

	if(type != MSG_NORDPRINT && !lock)
	{
	
		Sys_EnterCriticalSection(CRIT_REDIRECTPRINT);

		if ( !lock) {

			lock = qtrue;
			Com_PrintRedirect(msg, msglen);
			lock = qfalse;

			if ( rd_buffer ) {
				if(!rd_flush){
					Sys_LeaveCriticalSection(CRIT_REDIRECTPRINT);
					return;
				}
				if ((msglen + strlen(rd_buffer)) > (rd_buffersize - 1)) {

					lock = qtrue;
					rd_flush(rd_buffer, qfalse);
					lock = qfalse;

					*rd_buffer = 0;
				}
				Q_strcat(rd_buffer, rd_buffersize, msg);
				// TTimo nooo .. that would defeat the purpose
				//rd_flush(rd_buffer);
				//*rd_buffer = 0;
				Sys_LeaveCriticalSection(CRIT_REDIRECTPRINT);
				return;
			}
		}
		
		Sys_LeaveCriticalSection(CRIT_REDIRECTPRINT);
	
	}

	
	// echo to dedicated console and early console
	Sys_Print( msg );

	// logfile
	Com_PrintLogfile( msg );

}
开发者ID:Call-of-Duty-Scripts,项目名称:CoD4X18-Server,代码行数:54,代码来源:common_io.c

示例14: Cmd_Echo_f

/*
===============
Cmd_Echo_f

Just prints the rest of the line to the console
===============
*/
void Cmd_Echo_f( void )
{
	int	i;
	static char buf[1024];
	for( i = 1; i < Cmd_Argc(); i++ )
	{
		Q_strncat( buf, Cmd_Argv( i ), 1024 );
		Q_strncat( buf, " ", 1024 );
	}
	Q_strncat( buf, "\n", 1024 );
	Sys_Print( buf );
}
开发者ID:ShaunNoWay,项目名称:xash3d,代码行数:19,代码来源:cmd.c

示例15: Com_Debug_

void Com_Debug_(const char* format, ...)
{
	static char buffer[32768] = { 0 };

	va_list va;
	va_start(va, format);

	//vprintf(format, va);
	_vsnprintf(buffer, sizeof(buffer), format, va);
	va_end(va);

	if (console){
		Sys_Print("^3");
		Sys_Print(buffer);
		Sys_Print("^7");
	}
	else {
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
		printf(buffer);
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 7);
	}
}
开发者ID:FreeTheTech101,项目名称:zonebuilder,代码行数:22,代码来源:Util.cpp


注:本文中的Sys_Print函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。