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


C++ Q_strncat函数代码示例

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


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

示例1: AddHelp

	void AddHelp( int pane_key, const char *image, const char *desc )
	{
		int index = m_vHelpPanes.Find( pane_key );
		if ( index == m_vHelpPanes.InvalidIndex() )
		{
			Warning( "[ScenarioHelp] Invalid pane id provided to add help to, Pane %i\n", pane_key );
			return;
		}

		sHelpPane *pPane = m_vHelpPanes[ index ];

		if ( pPane->nHelpCount >= 4 )
		{
			Warning( "[ScenarioHelp] No more than 4 help items are allowed per pane, Pane %i\n", pane_key );
			return;
		}

		pPane->nHelpCount++;

		// Restrict string lengths
		char desc_clip[128];
		char image_clip[32];

		Q_strncpy( desc_clip,  (desc && desc[0])  ? desc  : " ", 128 );
		Q_strncpy( image_clip, (image && image[0]) ? image : " ", 32 );

		if ( pPane->szHelpString[0] != '\0' )
			Q_strncat( pPane->szHelpString, ";;;", 1024 );

		// Build and append the string to our help
		char szHelp[256];
		Q_snprintf( szHelp, 256, "%s::%s", desc_clip, image_clip );
		Q_strncat( pPane->szHelpString, szHelp, 1024 );
	}
开发者ID:Entropy-Soldier,项目名称:ges-legacy-code,代码行数:34,代码来源:ge_pygameplay.cpp

示例2: GetDBInfo

// This looks for pDBInfoFilename in the same path as pBaseExeFilename.
// The file has 3 lines: machine name (with database), database name, username
void GetDBInfo( const char *pDBInfoFilename, CDBInfo *pInfo )
{
	char baseExeFilename[512];
	if ( !GetModuleFileName( GetModuleHandle( NULL ), baseExeFilename, sizeof( baseExeFilename ) ) )
		Error( "GetModuleFileName failed." );
	
	// Look for the info file in the same directory as the exe.
	char dbInfoFilename[512];
	Q_strncpy( dbInfoFilename, baseExeFilename, sizeof( dbInfoFilename ) );
	Q_StripFilename( dbInfoFilename );

	if ( dbInfoFilename[0] == 0 )
		Q_strncpy( dbInfoFilename, ".", sizeof( dbInfoFilename ) );

	Q_strncat( dbInfoFilename, "/", sizeof( dbInfoFilename ), COPY_ALL_CHARACTERS );
	Q_strncat( dbInfoFilename, pDBInfoFilename, sizeof( dbInfoFilename ), COPY_ALL_CHARACTERS );

	FILE *fp = fopen( dbInfoFilename, "rt" );
	if ( !fp )
	{
		Error( "Can't open %s for database info.\n", dbInfoFilename );
	}

	if ( !ReadStringFromFile( fp, pInfo->m_HostName, sizeof( pInfo->m_HostName ) ) ||
		 !ReadStringFromFile( fp, pInfo->m_DBName, sizeof( pInfo->m_DBName ) ) || 
		 !ReadStringFromFile( fp, pInfo->m_UserName, sizeof( pInfo->m_UserName ) ) 
		 )
	{
		Error( "%s is not a valid database info file.\n", dbInfoFilename );
	}

	fclose( fp );
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:35,代码来源:mpi_stats.cpp

示例3: Q_strncat

//-----------------------------------------------------------------------------
// Purpose: Helper for spewing verbose sample information
// Input  : flags - 
// Output : char const
//-----------------------------------------------------------------------------
char const *DescribeFlags( int flags )
{
	static char outbuf[ 256 ];

	outbuf[ 0 ] = 0;

	if ( flags & FDEMO_USE_ORIGIN2 )
	{
		Q_strncat( outbuf, "USE_ORIGIN2, ", sizeof( outbuf ), COPY_ALL_CHARACTERS );
	}
	if ( flags & FDEMO_USE_ANGLES2 )
	{
		Q_strncat( outbuf, "USE_ANGLES2, ", sizeof( outbuf ), COPY_ALL_CHARACTERS );
	}
	if ( flags & FDEMO_NOINTERP )
	{
		Q_strncat( outbuf, "NOINTERP, ", sizeof( outbuf ), COPY_ALL_CHARACTERS );
	}

	int len = Q_strlen( outbuf );
	if ( len > 2 )
	{
		outbuf[ len - 2 ] = 0;
	}
	else
	{
		Q_strncpy( outbuf, "N/A", sizeof( outbuf ) );
	}
	return outbuf;
}
开发者ID:chrizonix,项目名称:RCBot2,代码行数:35,代码来源:demoinfo.cpp

示例4: Q_strlen

// Caller is responsible for delete[]'ing the array.
char *CTimer::GetMapFilePath()
{
	const char *pszMapname = (gpGlobals->mapname).ToCStr();
	size_t sz = Q_strlen("maps/") + strlen(pszMapname) + Q_strlen(".bla") + 1;
	char *pszPath = new char[sz];
	Q_strncpy(pszPath, "maps/", sz);
	Q_strncat(pszPath, pszMapname, sz);
	Q_strncat(pszPath, ".bla", sz);
	Q_FixSlashes(pszPath);
	return pszPath;
}
开发者ID:EspyEspurr,项目名称:game,代码行数:12,代码来源:Timer.cpp

示例5: 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

示例6: MakeFullPath

void MakeFullPath( const char *pIn, char *pOut, int outLen )
{
	if ( pIn[0] == '/' || pIn[0] == '\\' || pIn[1] == ':' )
	{
		// It's already a full path.
		Q_strncpy( pOut, pIn, outLen );
	}
	else
	{
		_getcwd( pOut, outLen );
		Q_strncat( pOut, "\\", outLen, COPY_ALL_CHARACTERS );
		Q_strncat( pOut, pIn, outLen, COPY_ALL_CHARACTERS );
	}
}
开发者ID:Bubbasacs,项目名称:FinalProj,代码行数:14,代码来源:vrad_launcher.cpp

示例7: Q_strncat

void CRagdollProp::GetAngleOverrideFromCurrentState( char *pOut, int size )
{
	pOut[0] = 0;
	for ( int i = 0; i < m_ragdoll.listCount; i++ )
	{
		if ( i != 0 )
		{
			Q_strncat( pOut, ",", size, COPY_ALL_CHARACTERS );

		}
		CFmtStr str("%d,%.2f %.2f %.2f", i, m_ragAngles[i].x, m_ragAngles[i].y, m_ragAngles[i].z );
		Q_strncat( pOut, str, size, COPY_ALL_CHARACTERS );
	}
}
开发者ID:paralin,项目名称:hl2sdk,代码行数:14,代码来源:physics_prop_ragdoll.cpp

示例8: FileSystem_GetExecutableDir

bool FileSystem_GetExecutableDir( char *exedir, int exeDirLen )
{
	exedir[0] = 0;

	if ( s_bUseVProjectBinDir )
	{
		const char *pProject = GetVProjectCmdLineValue();
		if ( !pProject )
		{
			// Check their registry.
			pProject = getenv( GAMEDIR_TOKEN );
		}
		if ( pProject )
		{
			Q_snprintf( exedir, exeDirLen, "%s%c..%cbin", pProject, CORRECT_PATH_SEPARATOR, CORRECT_PATH_SEPARATOR );
			return true;
		}
		return false;
	}

	if ( !Sys_GetExecutableName( exedir, exeDirLen ) )
		return false;
	Q_StripFilename( exedir );

	if ( IsX360() )
	{
		// The 360 can have its exe and dlls reside on different volumes
		// use the optional basedir as the exe dir
		if ( CommandLine()->FindParm( "-basedir" ) )
		{
			strcpy( exedir, CommandLine()->ParmValue( "-basedir", "" ) );
		}
	}

	Q_FixSlashes( exedir );

	// Return the bin directory as the executable dir if it's not in there
	// because that's really where we're running from...
	char ext[MAX_PATH];
	Q_StrRight( exedir, 4, ext, sizeof( ext ) );
	if ( ext[0] != CORRECT_PATH_SEPARATOR || Q_stricmp( ext+1, "bin" ) != 0 )
	{
		Q_strncat( exedir, CORRECT_PATH_SEPARATOR_S, exeDirLen, COPY_ALL_CHARACTERS );
		Q_strncat( exedir, "bin", exeDirLen, COPY_ALL_CHARACTERS );
		Q_FixSlashes( exedir );
	}
	
	return true;
}
开发者ID:Adidasman1,项目名称:source-sdk-2013,代码行数:49,代码来源:filesystem_init.cpp

示例9: Q_snprintf

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
int CTeamControlPoint::DrawDebugTextOverlays( void ) 
{
	int text_offset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		char tempstr[1024];
		Q_snprintf(tempstr, sizeof(tempstr), "INDEX: (%d)", GetPointIndex() );
		EntityText(text_offset,tempstr,0);
		text_offset++;

		Q_snprintf( tempstr, sizeof(tempstr), "Red Previous Points: ");
		for ( int i = 0; i < MAX_PREVIOUS_POINTS; i++ )
		{
			if ( m_TeamData[2].iszPreviousPoint[i] != NULL_STRING )
			{
				Q_strncat( tempstr, STRING(m_TeamData[2].iszPreviousPoint[i]), 1024, COPY_ALL_CHARACTERS );
				Q_strncat( tempstr, ", ", 1024, COPY_ALL_CHARACTERS );
			}
		}
		EntityText(text_offset,tempstr,0);
		text_offset++;

		Q_snprintf( tempstr, sizeof(tempstr), "Blue Previous Points: " );
		for ( int i = 0; i < MAX_PREVIOUS_POINTS; i++ )
		{
			if ( m_TeamData[3].iszPreviousPoint[i] != NULL_STRING )
			{
				Q_strncat( tempstr, STRING(m_TeamData[3].iszPreviousPoint[i]), 1024, COPY_ALL_CHARACTERS );
				Q_strncat( tempstr, ", ", 1024, COPY_ALL_CHARACTERS );
			}
		}
		EntityText(text_offset,tempstr,0);
		text_offset++;

		for ( int i = 0; i < MAX_CONTROL_POINT_TEAMS; i++ )
		{
			if ( ObjectiveResource()->GetBaseControlPointForTeam(i) == GetPointIndex() )
			{
				Q_snprintf(tempstr, sizeof(tempstr), "Base Control Point for Team %d", i );
				EntityText(text_offset,tempstr,0);
				text_offset++;
			}
		}
	}

	return text_offset;
}
开发者ID:xxauroraxx,项目名称:Source.Python,代码行数:51,代码来源:team_control_point.cpp

示例10: AppendTimer

static void AppendTimer( int idx, char *buf, size_t bufsize, CFastTimer& timer )
{
	char s[ 32 ];
	Q_snprintf( s, sizeof( s ), "%d %6.3f ms", idx, timer.GetDuration().GetMillisecondsF() );

	Q_strncat( buf, s, bufsize );
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:7,代码来源:ai_hint.cpp

示例11: SetPathSettings

void SetPathSettings( )
{
	char pPathBuf[ MAX_PATH*32 ];
	if ( GetVConfigRegistrySetting( "PATH", pPathBuf, sizeof(pPathBuf) ) )
	{
		Q_FixSlashes( pPathBuf );
		const char *pPath = pPathBuf;
		const char *pFound = Q_stristr( pPath, VPROJECT_BIN_PATH );
		int nLen = Q_strlen( VPROJECT_BIN_PATH );
		while ( pFound )
		{
			if ( pFound[nLen] == '\\' )
			{
				++nLen;
			}
			if ( !pFound[nLen] || pFound[nLen] == ';' )
				return;

			pPath += nLen;
			pFound = Q_stristr( pPath, VPROJECT_BIN_PATH );
		}

		Q_strncat( pPathBuf, ";%VPROJECT%\\..\\bin", sizeof(pPathBuf) );
	}
	else
	{
		Q_strncpy( pPathBuf, "%VPROJECT%\\..\\bin", sizeof(pPathBuf) );
	}

	SetVConfigRegistrySetting( "PATH", pPathBuf, false );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:31,代码来源:main.cpp

示例12: KeyValues

//Called every time a new time is achieved
void CTimer::SaveTime()
{
    const char *szMapName = gpGlobals->mapname.ToCStr();
    KeyValues *timesKV = new KeyValues(szMapName);
    int count = localTimes.Count();

    for (int i = 0; i < count; i++)
    {
        Time t = localTimes[i];
        char timeName[512];
        Q_snprintf(timeName, 512, "%i", t.ticks);
        KeyValues *pSubkey = new KeyValues(timeName);
        pSubkey->SetFloat("rate", t.tickrate);
        pSubkey->SetInt("date", t.date);
        timesKV->AddSubKey(pSubkey);
    }

    char file[MAX_PATH];
    Q_strcpy(file, c_mapDir);
    Q_strcat(file, szMapName, MAX_PATH);
    Q_strncat(file, c_timesExt, MAX_PATH);

    if (timesKV->SaveToFile(filesystem, file, "MOD", true))
    {
        Log("Successfully saved new time!\n");
        IGameEvent *savedEvent = gameeventmanager->CreateEvent("runtime_saved");
        if (savedEvent)
            gameeventmanager->FireEvent(savedEvent);
    }

    timesKV->deleteThis();
}
开发者ID:kirkelifson,项目名称:game,代码行数:33,代码来源:Timer.cpp

示例13: Q_strncpy

//-----------------------------------------------------------------------------
// Purpose: 
// Input  : handle - 
// Output : const char
//-----------------------------------------------------------------------------
bool CUtlFilenameSymbolTable::String( const FileNameHandle_t& handle, char *buf, int buflen )
{
	buf[ 0 ] = 0;

	FileNameHandleInternal_t *internal = ( FileNameHandleInternal_t * )&handle;
	if ( !internal )
	{
		return false;
	}

	m_lock.LockForRead();
	const char *path = m_StringPool.HandleToString(internal->path);
	const char *fn = m_StringPool.HandleToString(internal->file);
	m_lock.UnlockRead();

	if ( !path || !fn )
	{
		return false;
	}

	Q_strncpy( buf, path, buflen );
	Q_strncat( buf, fn, buflen, COPY_ALL_CHARACTERS );

	return true;
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:30,代码来源:utlsymbol.cpp

示例14: FS_Rename

/* <269e8> ../engine/filesystem_internal.cpp:292 */
void FS_Rename(const char *originalName, const char *newName)
{
    char *cut;
    char localPath[512];
    char newPath[512];

    if (FS_GetLocalPath(originalName, localPath, ARRAYSIZE(localPath)))
    {
        Q_strcpy(newPath, localPath);
        cut = Q_strstr(newPath, originalName);

        if (cut)
        {
            *cut = 0;
#ifdef REHLDS_CHECKS
            Q_strncat(newPath, newName, ARRAYSIZE(newPath) - Q_strlen(newPath));
            newPath[ARRAYSIZE(newPath) - 1] = 0;
#else
            Q_strcat(newPath, newName);
#endif

            rename(localPath, newPath);
        }
    }
}
开发者ID:Adidasman1,项目名称:rehlds,代码行数:26,代码来源:filesystem_internal.cpp

示例15: GetSteamCfgPath

FSReturnCode_t GetSteamCfgPath( char *steamCfgPath, int steamCfgPathLen )
{
	steamCfgPath[0] = 0;
	char executablePath[MAX_PATH];
	if ( !FileSystem_GetExecutableDir( executablePath, sizeof( executablePath ) ) )
	{
		return SetupFileSystemError( false, FS_INVALID_PARAMETERS, "FileSystem_GetExecutableDir failed." );
	}
	Q_strncpy( steamCfgPath, executablePath, steamCfgPathLen );
	while ( 1 )
	{
		if ( DoesFileExistIn( steamCfgPath, "steam.cfg" ) )
			break;
	
		if ( !Q_StripLastDir( steamCfgPath, steamCfgPathLen) )
		{
			// the file isnt found, thats ok, its not mandatory
			return FS_OK;
		}			
	}
	Q_AppendSlash( steamCfgPath, steamCfgPathLen );
	Q_strncat( steamCfgPath, "steam.cfg", steamCfgPathLen, COPY_ALL_CHARACTERS );

	return FS_OK;
}
开发者ID:AeroHand,项目名称:dota2-lua-engine,代码行数:25,代码来源:filesystem_init.cpp


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