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


C++ DefaultExtension函数代码示例

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


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

示例1: main

void main (int argc, char **argv)
{
	int			i;
	char		source[1024];
	int			size;
	FILE		*f;

	printf( "bspinfo.exe v2.1 (%s)\n", __DATE__ );
	printf ("---- bspinfo ----\n" );


	if (argc == 1)
		Error ("usage: bspinfo bspfile [bspfiles]");
		
	for (i=1 ; i<argc ; i++)
	{
		printf ("---------------------\n");
		strcpy (source, argv[i]);
		DefaultExtension (source, ".bsp");
		f = fopen (source, "rb");
		if (f)
		{
			size = filelength (f);
			fclose (f);
		}
		else
			size = 0;
		printf ("%s: %i\n", source, size);
		
		LoadBSPFile (source);		
		PrintBSPFileSizes ();
		printf ("---------------------\n");
	}
}
开发者ID:JoelTroch,项目名称:am_src_30jan2011,代码行数:34,代码来源:bspinfo.c

示例2: AddModules

static void AddModules( void )
{
    lib_cmd     *cmd;
    char        buff[ MAX_IMPORT_STRING ];

    for( cmd = CmdList; cmd != NULL; cmd = cmd->next ) {
        if( !( cmd->ops & OP_ADD ) )
            continue;
        strcpy( buff, cmd->name );
        if( cmd->ops & OP_IMPORT ) {
            ProcessImport( buff );
        } else {
            DefaultExtension( buff, EXT_OBJ );
            ProcessLibOrObj( buff, OBJ_PROCESS, AddOneObject );
        }
        Options.modified = TRUE;
        if( Options.ar && Options.verbose ) {
            if( cmd->ops & OP_DELETED ) {
                Message( "r - %s", cmd->name );
            } else {
                Message( "a - %s", cmd->name );
            }
        }
    }
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:25,代码来源:proclib.c

示例3: SaveSkinDialog

void SaveSkinDialog (void)
{
//	strcpy (szDirName, ValueForKey (project_entity, "basepath") );
//	strcat (szDirName, "\\maps");

	/* Place the terminating null character in the szFile. */

	szFile[0] = '\0';

	/* Set the members of the OPENFILENAME structure. */

	ofn.lStructSize = sizeof(OPENFILENAME);
	ofn.hwndOwner = mainwindow;
	ofn.lpstrFilter = szSkinFilter;
	ofn.nFilterIndex = 1;
	ofn.lpstrFile = szFile;
	ofn.nMaxFile = sizeof(szFile);
	ofn.lpstrFileTitle = szFileTitle;
	ofn.nMaxFileTitle = sizeof(szFileTitle);
	ofn.lpstrInitialDir = szDirName;
	ofn.Flags = OFN_SHOWHELP | OFN_PATHMUSTEXIST |
		OFN_FILEMUSTEXIST;

	/* Display the Open dialog box. */

	if (!GetSaveFileName(&ofn))
		return;	// canceled

	DefaultExtension (ofn.lpstrFile, ".lbm");
	Skin_SaveFile (ofn.lpstrFile);
	strcpy (skin_filename, ofn.lpstrFile);
}
开发者ID:Almamu,项目名称:Quake-2-Tools,代码行数:32,代码来源:win_main.c

示例4: MakeLITFile

void MakeLITFile (const char *filename)
{
	char	litname[1024];
	FILE	*litfile;
	litheader_t	litheader;

	strcpy (litname, filename);
	StripExtension (litname);
	DefaultExtension (litname, ".lit", sizeof(litname));
	litfile = fopen (litname, "wb");

	if (!litfile)
	{
		printf ("Unable to create %s\n", litname);
		return;
	}

	litheader.ident[0] = 'Q';
	litheader.ident[1] = 'L';
	litheader.ident[2] = 'I';
	litheader.ident[3] = 'T';
	litheader.version = LittleLong(LIT_VERSION);

	fwrite (&litheader, sizeof(litheader), 1, litfile);
	fwrite (&newdlightdata, newlightdatasize, 1, litfile);

	fclose (litfile);
	printf ("Wrote litfile: %s\n", litname);
}
开发者ID:crutchwalkfactory,项目名称:motocakerteam,代码行数:29,代码来源:litfile.c

示例5: SCharCount

C4SoundEffect* C4SoundSystem::GetEffect(const char *szSndName)
{
	// Remember wildcards before adding .* extension - if there are 2 versions with different file extensions, play the last added
	bool bRandomSound = SCharCount('?',szSndName) || SCharCount('*',szSndName);
	// Evaluate sound name
	char szName[C4MaxSoundName+2+1];
	SCopy(szSndName,szName,C4MaxSoundName);
	// Any extension accepted
	DefaultExtension(szName,"*");
	// Play nth Sound. Standard: 1
	int32_t iNumber = 1;
	// Sound with a wildcard: determine number of available matches
	if (bRandomSound)
	{
		iNumber = 0;
		// Count matching sounds
		for (C4SoundEffect *pSfx=FirstSound; pSfx; pSfx=pSfx->Next)
			if (WildcardMatch(szName,pSfx->Name))
				++iNumber;
		// Nothing found? Abort
		if(iNumber == 0)
			return NULL;
		iNumber=UnsyncedRandom(iNumber)+1;
	}
	// Find requested sound effect in bank
	C4SoundEffect *pSfx;
	for (pSfx=FirstSound; pSfx; pSfx=pSfx->Next)
		if (WildcardMatch(szName,pSfx->Name))
			if(!--iNumber)
				break;
	return pSfx; // Is still NULL if nothing is found
}
开发者ID:TheBlackJokerDevil,项目名称:openclonk,代码行数:32,代码来源:C4SoundSystem.cpp

示例6: Bspinfo

/*
============
Bspinfo
============
*/
void Bspinfo( int count, char **fileNames ) {
	int		i;
	char	source[1024];
	int			size;
	FILE		*f;

	if ( count < 1 ) {
		_printf( "No files to dump info for.\n");
		return;
	}

	for ( i = 0 ; i < count ; i++ ) {
		_printf ("---------------------\n");
		strcpy (source, fileNames[ i ] );
		DefaultExtension (source, ".bsp");
		f = fopen (source, "rb");
		if (f)
		{
			size = Q_filelength (f);
			fclose (f);
		}
		else
			size = 0;
		_printf ("%s: %i\n", source, size);
		
		LoadBSPFile (source);		
		PrintBSPFileSizes ();
		_printf ("---------------------\n");
	}
}
开发者ID:kingtiger01,项目名称:OpenMOHAA,代码行数:35,代码来源:bsp.c

示例7: SCopy

C4SoundEffect *C4SoundSystem::GetEffect(const char *szSndName) {
  C4SoundEffect *pSfx;
  char szName[C4MaxSoundName + 4 + 1];
  int32_t iNumber;
  // Evaluate sound name
  SCopy(szSndName, szName, C4MaxSoundName);
  // Default extension
  DefaultExtension(szName, "wav");
  // Convert old style '*' wildcard to correct '?' wildcard
  // For sound effects, '*' is supposed to match single digits only
  SReplaceChar(szName, '*', '?');
  // Sound with a wildcard: determine number of available matches
  if (SCharCount('?', szName)) {
    // Search global sound file
    if (!(iNumber = SoundFile.EntryCount(szName)))
      // Search scenario local files
      if (!(iNumber = Game.ScenarioFile.EntryCount(szName)))
        // Search bank loaded sounds
        if (!(iNumber = EffectInBank(szName)))
          // None found: failure
          return NULL;
    // Insert index to name
    iNumber = BoundBy(1 + SafeRandom(iNumber), 1, 9);
    SReplaceChar(szName, '?', '0' + iNumber);
  }
  // Find requested sound effect in bank
  for (pSfx = FirstSound; pSfx; pSfx = pSfx->Next)
    if (SEqualNoCase(szName, pSfx->Name)) break;
  // Sound not in bank, try add
  if (!pSfx)
    if (!(pSfx = AddEffect(szName))) return NULL;
  return pSfx;
}
开发者ID:ev1313,项目名称:yaC,代码行数:33,代码来源:C4SoundSystem.cpp

示例8: MakeAllScales

void MakeAllScales (void)
{
	strcpy(transferfile, source);
	StripExtension( transferfile );
	DefaultExtension( transferfile, ".r2" );

	if ( !incremental
	  || !IsIncremental(incrementfile)
	  || (unsigned)readtransfers(transferfile, num_patches) != num_patches )
	{
		// determine visibility between patches
		BuildVisMatrix ();

		RunThreadsOn (num_patches, true, MakeScales);
		if ( incremental )
			writetransfers(transferfile, num_patches);
		else
			unlink(transferfile);

		// release visibility matrix
		FreeVisMatrix ();
	}

	qprintf ("transfer lists: %5.1f megs\n"
		, (float)total_transfer * sizeof(transfer_t) / (1024*1024));
}
开发者ID:jpiolho,项目名称:halflife,代码行数:26,代码来源:qrad.c

示例9: VIS_Main

/*
   ===========
   main
   ===========
 */
int VIS_Main(){
	char portalfile[1024];
	char source[1024];
	char name[1024];
	double start, end;
	int total_vis_time;

	Sys_Printf( "\n----- VIS ----\n\n" );

	//if (i != argc - 1)
	//	Error ("usage: vis [-threads #] [-level 0-4] [-fast] [-v] bspfile");

	start = I_FloatTime();

	ThreadSetDefault();

	SetQdirFromPath( mapname );
	strcpy( source, ExpandArg( mapname ) );
	StripExtension( source );
	DefaultExtension( source, ".bsp" );

	sprintf( name, "%s%s", inbase, source );
	Sys_Printf( "reading %s\n", name );
	LoadBSPFile( name );
	if ( numnodes == 0 || numfaces == 0 ) {
		Error( "Empty map" );
	}

	sprintf( portalfile, "%s%s", inbase, ExpandArg( mapname ) );
	StripExtension( portalfile );
	strcat( portalfile, ".prt" );

	Sys_Printf( "reading %s\n", portalfile );
	LoadPortals( portalfile );

	CalcVis();

	CalcPHS();

	visdatasize = vismap_p - dvisdata;
	Sys_Printf( "visdatasize:%i  compressed from %i\n", visdatasize, originalvismapsize * 2 );

	sprintf( name, "%s%s", outbase, source );
	Sys_Printf( "writing %s\n", name );
	WriteBSPFile( name );

	end = I_FloatTime();
	total_vis_time = (int) ( end - start );
	Sys_Printf( "\nVIS Time: " );
	if ( total_vis_time > 59 ) {
		Sys_Printf( "%d Minutes ", total_vis_time / 60 );
	}
	Sys_Printf( "%d Seconds\n", total_vis_time % 60 );


	return 0;
}
开发者ID:Garux,项目名称:netradiant-custom,代码行数:62,代码来源:qvis.c

示例10: BSPInfo

int BSPInfo( int count, char **fileNames )
{
	int			i;
	char		source[ 1024 ], ext[ 64 ];
	int			size;
	FILE		*f;
	
	
	/* dummy check */
	if( count < 1 )
	{
		Sys_Printf( "No files to dump info for.\n");
		return -1;
	}
	
	/* enable info mode */
	infoMode = qtrue;
	
	/* walk file list */
	for( i = 0; i < count; i++ )
	{
		Sys_Printf( "---------------------------------\n" );
		
		/* mangle filename and get size */
		strcpy( source, fileNames[ i ] );
		ExtractFileExtension( source, ext );
		if( !Q_stricmp( ext, "map" ) )
			StripExtension( source );
		DefaultExtension( source, ".bsp" );
		f = fopen( source, "rb" );
		if( f )
		{
			size = Q_filelength (f);
			fclose( f );
		}
		else
			size = 0;
		
		/* load the bsp file and print lump sizes */
		Sys_Printf( "%s\n", source );
		LoadBSPFile( source );		
		PrintBSPFileSizes();
		
		/* print sizes */
		Sys_Printf( "\n" );
		Sys_Printf( "          total         %9d\n", size );
		Sys_Printf( "                        %9d KB\n", size / 1024 );
		Sys_Printf( "                        %9d MB\n", size / (1024 * 1024) );
		
		Sys_Printf( "---------------------------------\n" );
	}
	
	/* return count */
	return i;
}
开发者ID:ChunHungLiu,项目名称:GtkRadiant,代码行数:55,代码来源:main.c

示例11: WriteBSP

/*
============
WriteBSP
============
*/
void WriteBSP (char *name)
{
	char	path[1024];

	strcpy (path, name);
	DefaultExtension (path, ".bsp");

	SetModelNumbers ();
	SetLightStyles ();
	UnparseEntities ();

	if ( !onlyents )
		WriteMiptex ();

	WriteBSPFile (path);
}
开发者ID:6779660,项目名称:halflife,代码行数:21,代码来源:qcsg.c

示例12: DelModules

static void DelModules( void )
{
    lib_cmd     *cmd;
    char        buff[ MAX_IMPORT_STRING ];

    for( cmd = CmdList; cmd != NULL; cmd = cmd->next ) {
        if( !( cmd->ops & OP_DELETE ) )
            continue;
        strcpy( buff, cmd->name );
        DefaultExtension( buff, EXT_OBJ );
        if( IsExt( buff, EXT_LIB ) ) {
            ProcessLibOrObj( buff, OBJ_SKIP, DelOneObject );
            cmd->ops |= OP_DELETED;
        }
        if( !( cmd->ops & OP_DELETED ) && !( cmd->ops & OP_ADD ) ) {
                Warning( ERR_CANT_DELETE, cmd->name );
        } else if( ( cmd->ops & OP_DELETED ) && !( cmd->ops & OP_ADD ) && Options.ar && Options.verbose ) {
            Message( "-d %s", cmd->name );
        }
    }
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:21,代码来源:proclib.c

示例13: main

int main (int argc, char **argv)
{
	int			i;
	char		source[1024];

	if (argc == 1)
		Error ("usage: bspinfo bspfile [bspfiles]");
		
	for (i=1 ; i<argc ; i++)
	{
		printf ("---------------------\n");
		strcpy (source, argv[i]);
		DefaultExtension (source, ".bsp");
		printf ("%s\n", source);
		
		LoadBSPFile (source);		
		PrintBSPFileSizes ();
		printf ("---------------------\n");
	}
	return 0;
}
开发者ID:atphalix,项目名称:eviltoys,代码行数:21,代码来源:bspinfo.c

示例14: ProcessLumpyScript

/*
=================
ProcessLumpyScript

Loads a script file, then grabs everything from it
=================
*/
void ProcessLumpyScript (char *basename)
{
	char            script[256];

	printf ("qlumpy script: %s\n",basename);
	
//
// create default destination directory
//
	strcpy (destfile, ExpandPath(basename));
	StripExtension (destfile);
	strcat (destfile,".wad");		// unless the script overrides, save in cwd

//
// save in a wadfile by default
//
	savesingle = false;
	grabbed = 0;
	outputcreated = false;
	
	
//
// read in the script file
//
	strcpy (script, basename);
	DefaultExtension (script, ".ls");
	LoadScriptFile (script);
	
	strcpy (basepath, basename);
	
	ParseScript ();				// execute load / grab commands
	
	if (!savesingle)
	{
		WriteWad (do16bit);				// write out the wad directory
		printf ("%i lumps grabbed in a wad file\n",grabbed);
	}
	else
		printf ("%i lumps written seperately\n",grabbed);
}
开发者ID:DeadlyGamer,项目名称:cs16nd,代码行数:47,代码来源:qlumpy.c

示例15: SaveAsDialog

void SaveAsDialog (void)
{ 
	strcpy (szDirName, ValueForKey (g_qeglobals.d_project_entity, "basepath") );
	strcat (szDirName, "\\maps");

	/* Place the terminating null character in the szFile. */ 
 
	szFile[0] = '\0'; 
 
	/* Set the members of the OPENFILENAME structure. */ 
 
	ofn.lStructSize = sizeof(OPENFILENAME); 
	ofn.hwndOwner = g_qeglobals.d_hwndCamera;
	ofn.lpstrFilter = szFilter; 
	ofn.nFilterIndex = 1; 
	ofn.lpstrFile = szFile; 
	ofn.nMaxFile = sizeof(szFile); 
	ofn.lpstrFileTitle = szFileTitle; 
	ofn.nMaxFileTitle = sizeof(szFileTitle); 
	ofn.lpstrInitialDir = szDirName; 
	ofn.Flags = OFN_SHOWHELP | OFN_PATHMUSTEXIST | 
		OFN_FILEMUSTEXIST | OFN_OVERWRITEPROMPT; 

	/* Display the Open dialog box. */ 
 
	if (!GetSaveFileName(&ofn))
		return;	// canceled
  
	DefaultExtension (ofn.lpstrFile, ".map");
	strcpy (currentmap, ofn.lpstrFile);

	// Add the file in MRU.
	AddNewItem(g_qeglobals.d_lpMruMenu, ofn.lpstrFile);

	// Refresh the File menu.
	PlaceMenuMRUItem(g_qeglobals.d_lpMruMenu,GetSubMenu(GetMenu(g_qeglobals.d_hwndMain),0),
			ID_FILE_EXIT);

	Map_SaveFile (ofn.lpstrFile, false);	// ignore region
}
开发者ID:amitahire,项目名称:development,代码行数:40,代码来源:win_qe3.c


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