示例#1
0
void CmdExec_f()
{
	if ( gConsole.GetArgumentCount() < 2 )
		return;

	std::ifstream file( gConsole.GetArgument(1), ios::in );

	if ( !file.is_open() )
	{
		gConsole.Output("Unable to exec '%s'", gConsole.GetArgument(1) );
		return;
	}

	std::string str((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
	gConsole.AddCommand("\n");
	gConsole.AddCommand( (char*)str.c_str());
	gConsole.AddCommand("\n");
	
	file.close();
}
示例#2
0
void CmdEcho_f()
{
	if ( gConsole.GetArgumentCount() < 2 )
		return;
	gConsole.Output( gConsole.GetArgument(1) );
}