本文整理汇总了C++中StripExtension函数的典型用法代码示例。如果您正苦于以下问题:C++ StripExtension函数的具体用法?C++ StripExtension怎么用?C++ StripExtension使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了StripExtension函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char** argv) {
if (argc < 2 || argc > 3) {
printf(
"USAGE: URDFtoRob robot_file.urdf [optional filename for .rob]\n");
return 0;
}
string filename;
const char* fname;
if(argc == 2)
filename.assign(argv[1]);
else if(argc == 3)
filename.assign(argv[2]);
StripExtension(filename);
filename.append(".rob");
const char* ext = FileExtension(argv[1]);
string path = GetFilePath(argv[1]);
if (0 == strcmp(ext, "urdf")) {
Robot robot;
robot.LoadURDF(argv[1]);
robot.Save(filename.c_str(), path.c_str());
robot.SaveGeometry(path.c_str(),"tri");
} else {
printf("Unknown file extension %s on file %s!\nOnly converts URDF to Rob", ext, argv[1]);
return 1;
}
cout<<"Converted "<<argv[1]<<" to "<< filename<<endl;
cout << "Done!" << endl;
}
示例2: ImageInit
image_t *ImageFind( const char *filename )
{
int i;
char name[ 1024 ];
/* init */
ImageInit();
/* dummy check */
if( filename == NULL || filename[ 0 ] == '\0' )
return NULL;
/* strip file extension off name */
strcpy( name, filename );
StripExtension( name );
/* search list */
for( i = 0; i < MAX_IMAGES; i++ )
{
if( images[ i ].name != NULL && !strcmp( name, images[ i ].name ) )
return &images[ i ];
}
/* no matching image found */
return NULL;
}
示例3: Com_Error
/*
* @brief
*/
s_sample_t *S_LoadSample(const char *name) {
char key[MAX_QPATH];
s_sample_t *sample;
if (!s_env.initialized)
return NULL;
if (!name || !name[0]) {
Com_Error(ERR_DROP, "NULL name\n");
}
StripExtension(name, key);
if (!(sample = (s_sample_t *) S_FindMedia(key))) {
sample = (s_sample_t *) S_AllocMedia(key, sizeof(s_sample_t));
sample->media.Free = S_FreeSample;
S_LoadSampleChunk(sample);
S_RegisterMedia((s_media_t *) sample);
}
return sample;
}
示例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);
}
示例5: StripExtension
void be_root::Generate (be_ClientImplementation & source)
{
ostream & os = source.Stream ();
TList<be_CodeGenerator*>::iterator iit;
TList<be_Type*>::iterator bit;
for (iit = implementations.begin(); iit != implementations.end(); iit++)
{
(*iit)->Generate(source);
}
os << nl;
be_CodeGenerator::Generate (source);
os << nl;
if (BE_Globals::lite)
{
DDS_StdString BaseFilename;
BaseFilename = StripExtension(source.Filename());
os << "#include \"" << BaseFilename << "-lite.c" << "\"" << nl;
}
os << nl;
source.Close();
}
示例6: memset
int CBlockStream::Create( char *filename )
{
char newName[MAX_FILENAME_LENGTH], *id_header = IBI_HEADER_ID;
float version = IBI_VERSION;
//Clear the temp string
memset(newName, 0, sizeof(newName));
//Strip the extension and add the BLOCK_EXT extension
strcpy((char *) m_fileName, filename);
StripExtension( (char *) m_fileName, (char *) &newName );
strcat((char *) newName, IBI_EXT);
//Recover that as the active filename
strcpy(m_fileName, newName);
if ( (m_fileHandle = fopen(m_fileName, "wb")) == NULL )
{
return false;
}
fwrite( id_header, IBI_HEADER_ID_LENGTH, 1, m_fileHandle );
fwrite( &version, sizeof(version), 1, m_fileHandle );
return true;
}
示例7: Pointfile_Delete
void Pointfile_Delete( void ) {
char name[1024];
strcpy( name, currentmap );
StripExtension( name );
strcat( name, ".lin" );
remove( name );
}
示例8: WriteAASFile
/*
* @brief
*/
void WriteAASFile(void) {
char path[MAX_QPATH];
file_t *f;
StripExtension(bsp_name, path);
g_strlcat(path, ".aas", sizeof(path));
if (!(f = Fs_OpenWrite(path))) {
Com_Error(ERR_FATAL, "Couldn't open %s for writing\n", path);
}
Com_Print("Writing %d AAS nodes..\n", d_aas.num_nodes);
SwapAASFile();
d_bsp_header_t header;
memset(&header, 0, sizeof(header));
header.ident = LittleLong(AAS_IDENT);
header.version = LittleLong(AAS_VERSION);
Fs_Write(f, &header, 1, sizeof(header));
d_bsp_lump_t *lump = &header.lumps[AAS_LUMP_NODES];
WriteLump(f, lump, d_aas.nodes, sizeof(d_aas_node_t) * d_aas.num_nodes);
// rewrite the header with the populated lumps
Fs_Seek(f, 0);
Fs_Write(f, &header, 1, sizeof(header));
Fs_Close(f);
}
示例9: StripExtension
/*
* @brief Loads the music by the specified name.
*/
s_music_t *S_LoadMusic(const char *name) {
char key[MAX_QPATH];
s_music_t *music;
StripExtension(name, key);
if (!(music = (s_music_t *) S_FindMedia(key))) {
void *buffer;
SDL_RWops *rw;
Mix_Music *mus;
if (S_LoadMusicFile(key, &buffer, &rw, &mus)) {
music = (s_music_t *) S_AllocMedia(key, sizeof(s_music_t));
music->media.Retain = S_RetainMusic;
music->media.Free = S_FreeMusic;
music->buffer = buffer;
music->rw = rw;
music->music = mus;
S_RegisterMedia((s_media_t *) music);
} else {
Com_Debug("S_LoadMusic: Couldn't load %s\n", key);
music = NULL;
}
}
if (music) {
s_music_state.playlist = g_list_append(s_music_state.playlist, music);
}
return music;
}
示例10: ExportEntities
void ExportEntities( void ){
char filename[ 1024 ];
FILE *file;
/* note it */
Sys_FPrintf( SYS_VRB, "--- ExportEntities ---\n" );
/* do some path mangling */
strcpy( filename, source );
StripExtension( filename );
strcat( filename, ".ent" );
/* sanity check */
if ( bspEntData == NULL || bspEntDataSize == 0 ) {
Sys_Warning( "No BSP entity data. aborting...\n" );
return;
}
/* write it */
Sys_Printf( "Writing %s\n", filename );
Sys_FPrintf( SYS_VRB, "(%d bytes)\n", bspEntDataSize );
file = fopen( filename, "w" );
if ( file == NULL ) {
Error( "Unable to open %s for writing", filename );
}
fprintf( file, "%s\n", bspEntData );
fclose( file );
}
示例11: RadCreateDiffuseLights
void RadCreateDiffuseLights( void ){
/* startup */
Sys_FPrintf( SYS_VRB, "--- RadCreateDiffuseLights ---\n" );
numDiffuseSurfaces = 0;
numDiffuseLights = 0;
numBrushDiffuseLights = 0;
numTriangleDiffuseLights = 0;
numPatchDiffuseLights = 0;
numAreaLights = 0;
/* hit every surface (threaded) */
RunThreadsOnIndividual( numBSPDrawSurfaces, qtrue, RadLight );
/* dump the lights generated to a file */
if ( dump ) {
char dumpName[ 1024 ], ext[ 64 ];
FILE *file;
light_t *light;
strcpy( dumpName, source );
StripExtension( dumpName );
sprintf( ext, "_bounce_%03d.map", iterations );
strcat( dumpName, ext );
file = fopen( dumpName, "wb" );
Sys_Printf( "Writing %s...\n", dumpName );
if ( file ) {
for ( light = lights; light; light = light->next )
{
fprintf( file,
"{\n"
"\"classname\" \"light\"\n"
"\"light\" \"%d\"\n"
"\"origin\" \"%.0f %.0f %.0f\"\n"
"\"_color\" \"%.3f %.3f %.3f\"\n"
"}\n",
(int) light->add,
light->origin[ 0 ],
light->origin[ 1 ],
light->origin[ 2 ],
light->color[ 0 ],
light->color[ 1 ],
light->color[ 2 ] );
}
fclose( file );
}
}
/* increment */
iterations++;
/* print counts */
Sys_Printf( "%8d diffuse surfaces\n", numDiffuseSurfaces );
Sys_FPrintf( SYS_VRB, "%8d total diffuse lights\n", numDiffuseLights );
Sys_FPrintf( SYS_VRB, "%8d brush diffuse lights\n", numBrushDiffuseLights );
Sys_FPrintf( SYS_VRB, "%8d patch diffuse lights\n", numPatchDiffuseLights );
Sys_FPrintf( SYS_VRB, "%8d triangle diffuse lights\n", numTriangleDiffuseLights );
}
示例12: 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));
}
示例13: StripExtension
/**
* @brief
*/
static cm_material_t *Cm_LoadBspMaterials(const char *name) {
char base[MAX_QPATH];
StripExtension(Basename(name), base);
return Cm_LoadMaterials(va("materials/%s.mat", base), NULL);
}
示例14: searchTerm
/**
Helper function to find and kill the specified process
*/
TInt CGsaFlexiMergeManyFilesTest::FindAndKill(const TDesC& aProcessName)
{
TFullName searchTerm(aProcessName);
StripExtension(searchTerm);
searchTerm += _L("*");
TFindProcess find(searchTerm);
TFullName name;
TInt instancesFound = 0;
while(find.Next(name) == KErrNone)
{
RProcess process;
const TInt err = process.Open(find);
if (KErrNone == err)
{
if (process.ExitType() == EExitPending)
{
instancesFound++;
process.Kill(KErrCancel);
process.Close();
INFO_PRINTF2(_L("Process %S found and killed"), &aProcessName);
}
process.Close();
}
}
return instancesFound;
}
示例15: MAKEPACK_main
// package creation tool main function ----------------------------------------
//
void MAKEPACK_main( int argc, char **argv )
{
// clear options of main app
OPT_ClearOptions();
// register local options
OPT_RegisterStringOption( "p", "pack", Tm_SetPackageName );
OPT_RegisterStringOption( "f", "list", Tm_SetListName );
// exec all registered command line options
if ( !OPT_ExecRegisteredOptions( argc, argv ) ) {
Err_Printf( options_invalid );
Exit( EXIT_FAILURE );
}
// package name is mandatory
if ( arg_package_name[ 0 ] == 0 ) {
Err_Printf( pack_name_missing );
Exit( EXIT_FAILURE );
}
// list name is optional (use package with different extension by default)
if ( arg_list_name[ 0 ] == 0 ) {
strcpy( arg_list_name, arg_package_name );
StripExtension( arg_list_name );
strcat( arg_list_name, ".lst" );
}
// create package
CreatePackage( arg_package_name, arg_list_name );
// end of sub-application
Exit( EXIT_SUCCESS );
}