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


C++ IsFile函数代码示例

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


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

示例1: wsprintf

//---------------------------------------------------------------------------
void __fastcall TCodeView::SBEditClick(TObject *Sender)
{
	LPCSTR pName = "EUDCEDIT.EXE";
	if( sys.m_Eudc.IsEmpty() ){
		char dir[MAX_PATH];
		char bf[512];
		if( ::GetSystemDirectory(dir, sizeof(dir)) ){
	        wsprintf(bf, "%s\\%s", dir, pName);
            if( IsFile(bf) ) sys.m_Eudc = bf;
		}
		if( sys.m_Eudc.IsEmpty() && ::GetWindowsDirectory(dir, sizeof(dir)) ){
	        wsprintf(bf, "%s\\%s", dir, pName);
            if( IsFile(bf) ) sys.m_Eudc = bf;
        }
		if( sys.m_Eudc.IsEmpty() ){
	        wsprintf(bf, "%c:\\Program Files\\Accessories\\%s", dir[0], pName);
            if( IsFile(bf) ) sys.m_Eudc = bf;
        }
		if( sys.m_Eudc.IsEmpty() ) sys.m_Eudc = pName;
    }
	if( ::WinExec(sys.m_Eudc.c_str(), SW_SHOWDEFAULT) > 31 ){
	    ReqClose();
    }
    else {
		SBEdit->Enabled = FALSE;
        sys.m_fEudc = FALSE;
    }
}
开发者ID:mygaldre,项目名称:mmsstv,代码行数:29,代码来源:CodeVw.cpp

示例2: RmDir

void RmDir(const char *path)
{
	if(IsFile(path) || IsLnk(path))
	{
		remove(path);
		return;
	}
	char filePath[PATH_MAX];
	if(IsDir(path))
	{
		DIR *dir;
		struct dirent *ptr;
		dir = opendir(path);
		while(ptr = readdir(dir))
		{
			if(IsSpecial(ptr->d_name))
				continue;
			GetFilePath(path,ptr->d_name,filePath);
			if(IsDir(filePath))
			{
				RmDir(filePath);
				rmdir(filePath);
			}
			else if(IsFile(filePath) || IsLnk(filePath))
			{
				remove(filePath);
			}
		}
		closedir(dir);
	}
}
开发者ID:xinll,项目名称:virtualhost,代码行数:31,代码来源:tools.cpp

示例3: Check

bool CExportImageDialog::Check()
{
    if ( Save2D() && IsFile( mOutputFileName2D ) )
    {
        if ( !SimpleQuestion( "Do you want to overwrite existing file " + mOutputFileName2D + " ?" ) )
            return false;
    }

    if ( Save3D() && IsFile( mOutputFileName3D ) )
    {
        if ( !SimpleQuestion( "Do you want to overwrite existing file " + mOutputFileName3D + " ?" ) )
            return false;
    }

    if ( ( Save2D() && mOutputFileName2D.empty() ) || ( Save3D() && mOutputFileName3D.empty() ) )
	{
		SimpleErrorBox( "The output path of the file(s) to save must be specified." );
		return false;
	}
	if ( mOutputFileName2D == mOutputFileName3D )
	{
		SimpleErrorBox( "Cannot save both images to the same file" );
		return false;
	}
	return true;
}
开发者ID:BRAT-DEV,项目名称:main,代码行数:26,代码来源:ExportImageDialog.cpp

示例4: InstallMain

void InstallMain(char *name)
{
	char sysdir[MAX_PATH];
	char windir[MAX_PATH];
	char infdir[MAX_PATH];
	char otherdir[MAX_PATH];
	char infname[MAX_PATH];
	char deviceid[MAX_PATH];
	char sysname[MAX_PATH];
	if (name == NULL)
	{
		return;
	}
	if (strlen(name) == 0 || strlen(name) >= 5)
	{
		return;
	}

	GetSystemDirectory(sysdir, sizeof(sysdir));

	GetDirFromPath(windir, sysdir);

	sprintf(infdir, "%s\\inf", windir);

	sprintf(otherdir, "%s\\other", infdir);

	sprintf(infname, "%s\\Neo_%s.inf", infdir, name);

	sprintf(sysname, "%s\\Neo_%s.sys", sysdir, name);

	sprintf(deviceid, "NeoAdapter_%s", name);

	if (IsFile(infname) == FALSE)
	{
		Print("Failed to open %s.", infname);
		return;
	}
	if (IsFile(sysname) == FALSE)
	{
		Print("Failed to open %s.", sysname);
		return;
	}

	if (DiInstallClass(infname, 0) != OK)
	{
		Print("Failed to register %s.\n", infname);
		return;
	}

	if (InstallNDIDevice("Net", deviceid, NULL, NULL) != OK)
	{
		return;
	}
}
开发者ID:benapetr,项目名称:SoftEtherVPN,代码行数:54,代码来源:vpn16.c

示例5: testIsFileNormal_SymLink

/**
 * \brief for function IsFile
 * a file
 */
void testIsFileNormal_SymLink()
{
  system("echo 'hello world' > ./test.file");
  char Fname[] = "./test.file";
  int isFile = IsFile(Fname, 0);
  CU_ASSERT_EQUAL(isFile, 1);
  char NewFname[] = "./link.file";
  symlink(Fname, NewFname);
  isFile = IsFile(NewFname, 1);
  CU_ASSERT_EQUAL(isFile, 1);
#if 0
#endif
  RemoveDir(Fname);
  RemoveDir(NewFname);
}
开发者ID:7hibault,项目名称:fossology,代码行数:19,代码来源:testUtilities.c

示例6: sizeof

    bool
    Inode::GetSize(off_t & size)
    {
        size = 0;

        if ( ! IsFile() ) {
            if ( 0 == ::stat( Path().string().c_str(), &stat_ ) ) {
                size = stat_.st_size;
                return true;
            } else {
                size = 0;
                return false;
            }
        }

        int valuesize;
        bool ret = xattr_.GetValue(
                ATTRIBUTE_SIZE, &size, sizeof(size), valuesize );
        if ( ret ) {
            return true;
        }

        if ( 0 == ::stat( Path().string().c_str(), &stat_ ) ) {
            size = stat_.st_size;
        } else {
            size = 0;
        }
        return false;
    }
开发者ID:BDT-GER,项目名称:SWIFT-TLC,代码行数:29,代码来源:Inode.cpp

示例7: GetSoundShader

const SoundShaderT* SoundShaderManagerImplT::GetSoundShader(const std::string& Name)
{
    // Ignore empty names and just return NULL.
    if (Name.empty()) return NULL;

    // Note that I'm *not* just writing   return SoundShaders[Name]   here, because that
    // would implicitly create a NULL entry for every Name that does not actually exist.
    std::map<std::string, SoundShaderT*>::const_iterator It=m_SoundShaders.find(Name);

    if (It!=m_SoundShaders.end()) return It->second;

    // Sound shader not found, try to interpret the name as a filename or a "capture n" string.
    if (IsFile(Name) || IsCapture(Name))
    {
        SoundShaderT* AutoShader=new SoundShaderT(Name);
        AutoShader->AudioFile=Name;

        // Add auto created shader to list of shaders.
        m_SoundShaders[Name]=AutoShader;

        return AutoShader;
    }

    std::cout << "Error auto creating sound shader: File '" << Name << "' not doesn't exist.\n";
    return NULL;
}
开发者ID:mark711,项目名称:Cafu,代码行数:26,代码来源:SoundShaderManagerImpl.cpp

示例8: VLOG

bool MaprFileSystem::Remove(const std::string& uri){
  if (!Exists(uri)){
    VLOG(2) << "Can't remove file, it doesn't exist: " << uri;
    return false;
  }

  std::string path = GetUriPathOrDie(uri);
  std::string host = "default";
  hdfsFS fs = hdfsConnect(host.c_str(), 0); // use default config file settings
  CHECK(fs);
  if (IsFile(uri)){
    //LOG(INFO) << "removing file: " << uri;
    int retval = hdfsDelete(fs, path.c_str());
    CHECK_EQ(retval, 0);
  }
  else if (IsDirectory(uri)){
    //LOG(INFO) << "removing dir: " << uri;
    std::vector<std::string> dir_file_uris;
    CHECK(ListDirectory(uri, &dir_file_uris));
    BOOST_FOREACH(std::string file_uri, dir_file_uris){
      CHECK(Remove(file_uri));
    }
    int retval = hdfsDelete(fs, path.c_str());
    CHECK_EQ(retval, 0);
  }
开发者ID:Minione,项目名称:iwct,代码行数:25,代码来源:fs_mapr.cpp

示例9: Close

/*******************************************************************
*
* CSVClose
*
*******************************************************************/
int CSVload::Close()
{
	if( !IsFile() ){return 0;}
	if( fclose(m_filePointer) == -1){return -1;}
	m_filePointer = NULL;
	return 1;
}
开发者ID:GothHarvester,项目名称:ElevatorApplication,代码行数:12,代码来源:CSVLoad.cpp

示例10: SendMessage

bool FtpConnHandler::On_RETR()
{
    if (*last_cmd_arg_ == '\0')
        return SendMessage(550, "No file specified.");

    std::string path;
    if (*last_cmd_arg_ == '/')
        path = last_cmd_arg_;
    else
        path = working_dir_ + "/" + last_cmd_arg_;

    if (!NormalizePath(path))
        return SendMessage(550, "File unavailable.");
    if (!IsFile("." + path))
        return SendMessage(550, "Not a file.");

    if (!OpenDataConnection())
        return SendMessage(425, "Can't open data connection.");
    if (!SendMessage(150, "Here comes the file content."))
        return false;

    bool succeed = SendFile("." + path, bin_mode_, sock_data_);
    CloseDataConnection();

    if (!succeed)
        return SendMessage(451, "Requested action aborted: local error in processing.");

    return SendMessage(226, "File send OK.");
}
开发者ID:kaifengz,项目名称:fasmio,代码行数:29,代码来源:ftp.cpp

示例11: checkArgs

/*Function to check the validity of the
users arguments */ 
void checkArgs (int argc, char **argv){

	//check the number of arguments. Argc must be 3 in this case
	if (argc != 3){
		printf("Query engine only takes 3 arguments\n");
		exit(1);
	}

	//check if the file given for the data is valid
	char *argv1 = argv[1];
	if (IsFile(argv1)){
		printf("%s is a file which exists\n", argv1);
	}
	else{
		printf("%s does not exist. Please enter a path to a data file which exists\n", argv1);	
		exit(1);
	}

	//Check if the second argument is a valid directory
	char* argv2 = argv[2];
	if(IsDir(argv2)){
		printf("%s is a valid directory\n", argv2);
	}
	else{
		printf("%s is not a valid directory\n", argv2);
		exit(1);
	}

	printf("Valid Arguments. Starting indexer\n");

}
开发者ID:ArminMahban,项目名称:C_code_samples,代码行数:33,代码来源:query.c

示例12: GetCurFileName

//---------------------------------------------------------------------------
void __fastcall TFileViewDlg::KPOLClick(TObject *Sender)
{
	if( (m_CurFile < 0) || (pCurPage->pList == NULL) ) return;

	Mmsstv->AdjustPage(pgTemp);
	AnsiString as;
	GetCurFileName(as);
	if( IsFile(as.c_str()) ){
		CDrawOle *pDraw = (CDrawOle *)Mmsstv->DrawMain.MakeItem(CM_OLE);
		LPCSTR pExt = GetEXT(as.c_str());
		if( !strcmpi(pExt, "BMP")){
			pDraw->LoadFromFile(-1, 0, as.c_str());
		}
		else {
			Graphics::TBitmap *pBmp = MakeCurrentBitmap();
			pDraw->LoadFromBitmap(-1, 0, pBmp);
			if( !strcmpi(pExt, "JPG") ){
				pDraw->m_Trans = 0;
				pDraw->m_Stretch = 1;
			}
			delete pBmp;
		}
		Mmsstv->AddItem(pDraw, 0);
	}
}
开发者ID:mygaldre,项目名称:mmsstv,代码行数:26,代码来源:fileview.cpp

示例13:

FileInfo *  VFSHandle_ZIP::Read(void)
{
	if(IsFile(m_file) == true){
		char *buffer = (char *)Read(m_length);

		char	*filename	=	m_lfh[m_fileid]->filename;
		char	*tempdir	=	fusion->vfs->GetTempDirectory();

		if(tempdir == NULL){
			fusion->vfs->SetTempDirectory("vfstemp");
			tempdir = fusion->vfs->GetTempDirectory();
		}

		char fn[256];

		sprintf(fn,"%s/%s",tempdir,filename);

		m_handle = fusion->vfs->Open(fn,"binary",true);

		if(m_handle != NULL){
			m_handle->Write(buffer,m_length);
			fusion->vfs->Close(m_handle);
		}

		m_handle = fusion->vfs->Open(fn);

		m_length = m_handle->Length();

		delete[] buffer;

		return m_handle->Read();
	}

	return NULL;
}
开发者ID:christhomas,项目名称:fusionengine,代码行数:35,代码来源:VFSHandle_ZIP.cpp

示例14: CloseBitmap

//---------------------------------------------------------------------------
int __fastcall CThumb::UpdateBitmap(int n)
{
	if( pBitmap == NULL ) return FALSE;

	CloseBitmap();
	n /= THUMBWIND;
	if( n == m_Top ) return TRUE;
	m_Top = n;
	char name[256];
	sprintf(name, "%sFindex\\B%02u%u.bmp", BgnDir, m_FolderIndex, n);
	MultProc();
	int r = FALSE;
	m_UpdateBmp = 1;
	if( IsFile(name) ){
		::LoadBitmap(pBitmap, name);
		MultProc();
		if( (pBitmap->Width != m_XW) || (pBitmap->Height != m_SizeY) ){
			pBitmap->Width = m_XW;
			pBitmap->Height = m_SizeY;
		}
		else {
			m_UpdateBmp = 0;
			r = TRUE;
		}
	}
	if( r == FALSE ){
		n *= THUMBWIND;
		for( int i = n; i < (n + THUMBWIND); i++ ){
			if( i < m_FileCount ) pITBL[i+1].crc = 0;
		}
	}
	MultProc();
	return r;
}
开发者ID:mygaldre,项目名称:mmsstv,代码行数:35,代码来源:fileview.cpp

示例15: IsDemiliter

/*******************************************************************
*
* IsDemiliter
*
*******************************************************************/
bool CSVload::IsDemiliter()
{
	if( !IsFile() ){return false;}
	if(m_lastChar == ','){ return true; }
	if(m_lastChar == '\n'){ return true; }
	return false;
}
开发者ID:GothHarvester,项目名称:ElevatorApplication,代码行数:12,代码来源:CSVLoad.cpp


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