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


C++ GetExt函数代码示例

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


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

示例1: SetApplication

int SetApplication(const char * app, const char * filename)
{
	gchar * p=GetExt(app);
	if(!p) return 1;
	if(strcmp(p,"desktop")) return 1;

	char * ext=GetExt(filename);
	if(!ext) return 1;

//	ClassString setfile = g_strdup_printf("%s/.config/billfm/mime2command.txt",g_get_home_dir());
	ClassString setfile=g_build_filename(config_path,"mime2command.txt",NULL);
	FILE * f = fopen (setfile.s,"a+");
	if(!f)
	{	
		printf("Not open %s\n",setfile.s);
		return 1;
	}	

	ClassString str=g_strdup_printf("%s %s\n",ext,app);
	fwrite(str.s,strlen(str.s),1,f);
	fclose(f);

	InsertCommand(ext,g_strdup(app));
	return 0;
}
开发者ID:billfm,项目名称:billfm,代码行数:25,代码来源:mainmenu.cpp

示例2: OutHelp

void CommandData::ProcessCommand()
{
#ifndef SFX_MODULE

  const wchar *SingleCharCommands=L"FUADPXETK";
  if (Command[0]!=0 && Command[1]!=0 && wcschr(SingleCharCommands,Command[0])!=NULL || *ArcName==0)
    OutHelp(*Command==0 ? RARX_SUCCESS:RARX_USERERROR); // Return 'success' for 'rar' without parameters.

#ifdef _UNIX
  if (GetExt(ArcName)==NULL && (!FileExist(ArcName) || IsDir(GetFileAttr(ArcName))))
    wcsncatz(ArcName,L".rar",ASIZE(ArcName));
#else
  if (GetExt(ArcName)==NULL)
    wcsncatz(ArcName,L".rar",ASIZE(ArcName));
#endif

  if (wcschr(L"AFUMD",*Command)==NULL)
  {
    if (GenerateArcName)
      GenerateArchiveName(ArcName,ASIZE(ArcName),GenerateMask,false);

    StringList ArcMasks;
    ArcMasks.AddString(ArcName);
    ScanTree Scan(&ArcMasks,Recurse,SaveSymLinks,SCAN_SKIPDIRS);
    FindData FindData;
    while (Scan.GetNext(&FindData)==SCAN_SUCCESS)
      AddArcName(FindData.Name);
  }
  else
    AddArcName(ArcName);
#endif

  switch(Command[0])
  {
    case 'P':
    case 'X':
    case 'E':
    case 'T':
    case 'I':
      {
        CmdExtract Extract(this);
        Extract.DoExtract();
      }
      break;
#ifndef SILENT
    case 'V':
    case 'L':
      ListArchive(this);
      break;
    default:
      OutHelp(RARX_USERERROR);
#endif
  }
  if (!BareOutput)
    mprintf(L"\n");
}
开发者ID:MisterZeus,项目名称:SNES-Tracker,代码行数:56,代码来源:cmddata.cpp

示例3: OutHelp

void CommandData::ProcessCommand()
{
#ifndef SFX_MODULE
  if (Command[1] && strchr("FUADPXETK",*Command)!=NULL || *ArcName==0)
    OutHelp();

#ifdef _UNIX
  if (GetExt(ArcName)==NULL && (!FileExist(ArcName) || IsDir(GetFileAttr(ArcName))))
    strcat(ArcName,".rar");
#else
  if (GetExt(ArcName)==NULL)
    strcat(ArcName,".rar");
#endif

  if (strchr("AFUMD",*Command)==NULL)
  {
    StringList ArcMasks;
    ArcMasks.AddString(ArcName);
    ScanTree Scan(&ArcMasks,Recurse,SaveLinks,SCAN_SKIPDIRS);
    FindData FindData;
    while (Scan.GetNext(&FindData)==SCAN_SUCCESS)
      AddArcName(FindData.Name,FindData.NameW);
  }
  else
    AddArcName(ArcName,NULL);
#endif

  switch(Command[0])
  {
    case 'P':
    case 'X':
    case 'E':
    case 'T':
    case 'I':
      {
        CmdExtract Extract;
        Extract.DoExtract(this);
      }
      break;
#if !defined(GUI) && !defined(SILENT)
    case 'V':
    case 'L':
      ListArchive(this);
      break;
    default:
      OutHelp();
#endif
  }
#ifndef GUI
  if (!BareOutput)
    mprintf("\n");
#endif
}
开发者ID:ProfDrLuigi,项目名称:zanka,代码行数:53,代码来源:cmddata.cpp

示例4: GetExt

char *ReadFileBuf(char *name, int *size)
{
    FILE *fp;
    char *buf, *ext;
    int txt = 1;
    int n;

    ext = GetExt(name);
    if (!StrCmp(ext, ".txt")) {
        txt = 1;
    } else {
        txt = 0;
    }
    fp = FOpen(name, "rb");
    if (fp == NULL) {
        return NULL;
    }
    fseek(fp, 0, SEEK_END);
    n = ftell(fp);
    fseek(fp, 0, SEEK_SET);
    buf = (char *)Malloc(sizeof(char) * n);
    fread(buf, sizeof(char), n, fp);
    if (txt) {
        buf[n - 1] = '\0';
    }
    FClose(fp);
    *size = n;
    return buf;
}
开发者ID:f3yagi,项目名称:mysrc,代码行数:29,代码来源:pack_reader.cpp

示例5: GetAutoRenamedName

bool GetAutoRenamedName(wchar *Name,size_t MaxNameSize)
{
  wchar NewName[NM];
  size_t NameLength=wcslen(Name);
#ifdef _ANDROID
  if (NameLength>ASIZE(NewName)-10)
    return false;
#endif
  wchar *Ext=GetExt(Name);
  if (Ext==NULL)
    Ext=Name+NameLength;
  for (uint FileVer=1;;FileVer++)
  {
#ifdef _ANDROID // No swprintf in Android NDK r9.
    uint NamePrefixLength=Ext-Name;
    wcsncpy(NewName,Name,NamePrefixLength);
    wcscpy(NewName+NamePrefixLength,L"(");
    itoa(FileVer,NewName+NamePrefixLength+1,ASIZE(NewName)-NamePrefixLength-1);
    wcsncatz(NewName,L")",ASIZE(NewName));
    wcsncatz(NewName,Ext,ASIZE(NewName));
#else
    swprintf(NewName,ASIZE(NewName),L"%.*ls(%u)%ls",uint(Ext-Name),Name,FileVer,Ext);
#endif
    if (!FileExist(NewName))
    {
      wcsncpyz(Name,NewName,MaxNameSize);
      break;
    }
    if (FileVer>=1000000)
      return false;
  }
  return true;
}
开发者ID:ccarpo,项目名称:ComicStreamer,代码行数:33,代码来源:filcreat.cpp

示例6: CheckExt

static int CheckExt(char *filename)
{
	int i;
	char *ext = GetExt(filename);
	for (i = 0; nez_extlist[i]; i++) if (!xstricmp(ext, nez_extlist[i])) return 1;
	return 0;
}
开发者ID:wbb1977,项目名称:modo_android,代码行数:7,代码来源:nez.c

示例7: GetMimeForFile

static int GetMimeForFile(const char * name, struct stat * file_stat)
{

	if(S_ISDIR(file_stat->st_mode))	return 1;
	if(S_ISFIFO(file_stat->st_mode))	return 0;
	ClassString p=GetExt(name);
	if(p.s)
	{	
		if(!strcmp(p.s,"desktop"))
		{
			ClassString s=GetIconDesktopName(name);
			if(!s.s)
			{	
				return 0;
			}	
			return InsertIconName(s.s);
		}
		InfoMime * info= find_mime(p.s);	
		if(info)
		{
			if(info->icon_index) return info->icon_index;
		}
	}

	return IsExecute(name,file_stat,0);
}
开发者ID:billfm,项目名称:billfm,代码行数:26,代码来源:mime.cpp

示例8: NextVolumeName

void NextVolumeName(char *ArcName,bool OldNumbering)
{
  char *ChPtr;
  if ((ChPtr=GetExt(ArcName))==NULL)
  {
    strcat(ArcName,".rar");
    ChPtr=GetExt(ArcName);
  }
  else
    if (ChPtr[1]==0 || stricomp(ChPtr+1,"exe")==0 || stricomp(ChPtr+1,"sfx")==0)
      strcpy(ChPtr+1,"rar");
  if (!OldNumbering)
  {
    ChPtr=GetVolNumPart(ArcName);

    while ((++(*ChPtr))=='9'+1)
    {
      *ChPtr='0';
      ChPtr--;
      if (ChPtr<ArcName || !isdigit(*ChPtr))
      {
        for (char *EndPtr=ArcName+strlen(ArcName);EndPtr!=ChPtr;EndPtr--)
          *(EndPtr+1)=*EndPtr;
        *(ChPtr+1)='1';
        break;
      }
    }
  }
  else
    if (!isdigit(*(ChPtr+2)) || !isdigit(*(ChPtr+3)))
      strcpy(ChPtr+2,"00");
    else
    {
      ChPtr+=3;
      while ((++(*ChPtr))=='9'+1)
        if (*(ChPtr-1)=='.')
        {
          *ChPtr='A';
          break;
        }
        else
        {
          *ChPtr='0';
          ChPtr--;
        }
    }
}
开发者ID:BITINT,项目名称:DEFCON2,代码行数:47,代码来源:pathfn.cpp

示例9: NextVolumeName

void NextVolumeName(wchar *ArcName,uint MaxLength,bool OldNumbering)
{
  wchar *ChPtr;
  if ((ChPtr=GetExt(ArcName))==NULL)
  {
    wcsncatz(ArcName,L".rar",MaxLength);
    ChPtr=GetExt(ArcName);
  }
  else
    if (ChPtr[1]==0 && wcslen(ArcName)<MaxLength-3 || wcsicomp(ChPtr+1,L"exe")==0 || wcsicomp(ChPtr+1,L"sfx")==0)
      wcscpy(ChPtr+1,L"rar");
  if (!OldNumbering)
  {
    ChPtr=GetVolNumPart(ArcName);

    while ((++(*ChPtr))=='9'+1)
    {
      *ChPtr='0';
      ChPtr--;
      if (ChPtr<ArcName || !IsDigit(*ChPtr))
      {
        for (wchar *EndPtr=ArcName+wcslen(ArcName);EndPtr!=ChPtr;EndPtr--)
          *(EndPtr+1)=*EndPtr;
        *(ChPtr+1)='1';
        break;
      }
    }
  }
  else
    if (!IsDigit(*(ChPtr+2)) || !IsDigit(*(ChPtr+3)))
      wcscpy(ChPtr+2,L"00");
    else
    {
      ChPtr+=3;
      while ((++(*ChPtr))=='9'+1)
        if (*(ChPtr-1)=='.')
        {
          *ChPtr='A';
          break;
        }
        else
        {
          *ChPtr='0';
          ChPtr--;
        }
    }
}
开发者ID:KyleSanderson,项目名称:mpc-hc,代码行数:47,代码来源:pathfn.cpp

示例10: OnSyncUserMetaData

	void OnSyncUserMetaData(userrec* user, Module* proto,void* opaque, const std::string &extname, bool displayable)
	{
		if ((displayable) && (extname == "IDENT"))
		{
			std::string* ident;
			if (GetExt("IDENT", ident))
				proto->ProtoSendMetaData(opaque, TYPE_USER, user, extname, *ident);
		}
	}
开发者ID:TuSuNaMi,项目名称:ircd-sakura,代码行数:9,代码来源:m_ident.cpp

示例11: GetAutoRenamedName

bool GetAutoRenamedName(char *Name,wchar *NameW)
{
  char NewName[NM];
  wchar NewNameW[NM];

  if ((Name!=NULL && strlen(Name)>ASIZE(NewName)-10) || 
      (NameW!=NULL && wcslen(NameW)>ASIZE(NewNameW)-10))
    return(false);
  char *Ext=NULL;
  if (Name!=NULL && *Name!=0)
  {
    Ext=GetExt(Name);
    if (Ext==NULL)
      Ext=Name+strlen(Name);
  }
  wchar *ExtW=NULL;
  if (NameW!=NULL && *NameW!=0)
  {
    ExtW=GetExt(NameW);
    if (ExtW==NULL)
      ExtW=NameW+wcslen(NameW);
  }
  *NewName=0;
  *NewNameW=0;
  for (int FileVer=1;;FileVer++)
  {
    if (Name!=NULL && *Name!=0)
      sprintf(NewName,"%.*s(%d)%s",int(Ext-Name),Name,FileVer,Ext);
    if (NameW!=NULL && *NameW!=0)
      sprintfw(NewNameW,ASIZE(NewNameW),L"%.*s(%d)%s",int(ExtW-NameW),NameW,FileVer,ExtW);
    if (!FileExist(NewName,NewNameW))
    {
      if (Name!=NULL && *Name!=0)
        strcpy(Name,NewName);
      if (NameW!=NULL && *NameW!=0)
        wcscpy(NameW,NewNameW);
      break;
    }
    if (FileVer>=1000000)
      return(false);
  }
  return(true);
}
开发者ID:pfalcon,项目名称:PhotoTvViewer,代码行数:43,代码来源:filcreat.cpp

示例12: ParseProfilesDir

static bool ParseProfilesDir()
{
	if(!dir)
		return false;

	char *ext;
	struct dirent *entry = NULL;

	int i = 0;

	while(i < MAX_BROWSER_SIZE)
	{
		entry = readdir(dir);

		if(entry == NULL)
			break;

		if(entry->d_name[0] == '.' && entry->d_name[1] != '.')
			continue;

		if(strcmp(entry->d_name, "..") == 0)
			continue;

		if(entry->d_type==DT_DIR) continue;

		ext = GetExt(entry->d_name);
		if(ext == NULL || stricmp(ext, "wtp") != 0)
			continue;

		if(!AddBrowserEntry())
		{
			break;
		}

		snprintf(browserList[browser.numEntries+i].filename, MAXJOLIET, "%s", entry->d_name);
		StripExt(browserList[browser.numEntries+i].displayname, browserList[browser.numEntries+i].filename); // hide file extension

		i++;
	}

	// Sort the file list
	if(i >= 0)
		qsort(browserList, browser.numEntries+i, sizeof(BROWSERENTRY), FileSortCallback);

	browser.numEntries += i;

	if(entry == NULL)
	{
		closedir(dir); // close directory
		dir = NULL;
		return false; // no more entries
	}
	return true; // more entries
}
开发者ID:ifish12,项目名称:WiiTweet,代码行数:54,代码来源:profilebrowser.cpp

示例13: ConvertWav

void ConvertWav(const char *pSearch)
{
	WIN32_FIND_DATA fd;

	char poo[1024];
	strcpy(poo, pSearch);
	strcat(poo, "\\*");

	HANDLE find = FindFirstFile(poo, &fd);

	if(find == INVALID_HANDLE_VALUE)
	{
		printf("Something went very wrong :(\n");
		return;
	}

	BOOL found = true;

	while(found)
	{
		if(strcmp(fd.cFileName, ".") && strcmp(fd.cFileName, ".."))
		{
			if(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
			{
				strcpy(poo, pSearch);
				strcat(poo, "\\");
				strcat(poo, fd.cFileName);
				ConvertWav(poo);
			}
			else if(!stricmp(GetExt(fd.cFileName),"wav"))
			{
				strcpy(poo, "C:\\oggenc -q4 \"");
				strcat(poo, pSearch);
				strcat(poo, "\\");
				strcat(poo, fd.cFileName);
				strcat(poo, "\"");

				system(poo);

				strcpy(poo, "del \"");
				strcat(poo, pSearch);
				strcat(poo, "\\");
				strcat(poo, fd.cFileName);
				strcat(poo, "\"");

				system(poo);
			}
		}

		found = FindNextFile(find, &fd);
	}

	FindClose(find);
}
开发者ID:FujiGameJam,项目名称:fuji,代码行数:54,代码来源:oggencall.cpp

示例14: GetIconByName

GdkPixbuf * GetIconByName(const char * name, int size)
{
    if(name[0]=='~')
	{	
		ClassString str=g_strdup_printf("%s%s",g_get_home_dir(),&name[1]);
		return gdk_pixbuf_new_from_file_at_scale(str.s,size,size,1,0);
	}	
	if(name[0]=='/')
	{
		return gdk_pixbuf_new_from_file_at_scale(name,size,size,1,0);
	}

	if(name[0]=='.')
	{
		ClassString str=g_strdup_printf("%s%s",app_path,&name[1]);
		return gdk_pixbuf_new_from_file_at_scale(str.s,size,size,1,0);
	}
	
	GtkIconTheme * icon_theme = gtk_icon_theme_get_default();
	GtkIconInfo* inf = gtk_icon_theme_lookup_icon( icon_theme, name, size, 
	                                              GTK_ICON_LOOKUP_USE_BUILTIN );
	if(!inf)
	{
		ClassString ext=GetExt(name);
		if(ext.s)
		{
			gchar * new_name=g_strdup(name);
			new_name[strlen(name)-1-strlen(ext.s)]=0;
			inf = gtk_icon_theme_lookup_icon( icon_theme, new_name, size, 
	                                              GTK_ICON_LOOKUP_USE_BUILTIN );			
		}
	}

	if(inf)
	{
		const char * file = gtk_icon_info_get_filename( inf );
		if(file)
		{	
			GdkPixbuf * pixbuf=gdk_pixbuf_new_from_file( file, NULL );
			if(pixbuf)
			{	
				return gdk_pixbuf_scale_simple(pixbuf,size,size,GDK_INTERP_BILINEAR);
			}	
		}	
			
	} else
	{
		printf("Not found inf %s\n",name);
	}	
		

	return 0;
}
开发者ID:billfm,项目名称:billfm,代码行数:53,代码来源:mime.cpp

示例15: OutHelp

void CommandData::ProcessCommand()
{
#ifndef SFX_MODULE
  const char *SingleCharCommands="FUADPXETK";
  if (Command[1] && strchr(SingleCharCommands,*Command)!=NULL || *ArcName==0)
    OutHelp();

  	  //get filename *ArcName
#ifdef _UNIX
  if (GetExt(ArcName)==NULL && (!FileExist(ArcName) || IsDir(GetFileAttr(ArcName))))
    strcat(ArcName,".rar");
#endif

  	  //printf("test4  %c  %s\n",*Command,ArcName);
  	  //找文件,将ArcName传到FindData.Name
  if (strchr("AFUMD",*Command)==NULL)
  {
    StringList ArcMasks;
    ArcMasks.AddString(ArcName);
    ScanTree Scan(&ArcMasks,Recurse,SaveLinks,SCAN_SKIPDIRS);
    FindData FindData;
    while (Scan.GetNext(&FindData)==SCAN_SUCCESS)
      AddArcName(FindData.Name,FindData.NameW);		//FindData.Name 	"ere.rar"
  }
#endif

  switch(Command[0])
  {
    case 'P':
    case 'X':
    case 'E':
    case 'T':
    case 'I':
      {
    	printf("\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n");
        CmdExtract Extract;
        Extract.DoExtract(this);
        printf("\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\n");
      }
      break;
#ifndef SILENT
    case 'V':
    case 'L':
      ListArchive(this);
      break;
    default:
      OutHelp();
#endif
  }
  if (!BareOutput)
    mprintf("\n");
}
开发者ID:sevenshine,项目名称:crackRar,代码行数:52,代码来源:cmddata.cpp


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