• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetFileInfo函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: _T

void CSpyUserPanel::OnSpyFileItemActivated(wxListEvent& event)
{
    wxString strCurLocaitoin = m_pFileLocationText->GetValue();
    bool bIsRootLocation = strCurLocaitoin.Length() == 3 && strCurLocaitoin[1] == _T(':');
    wxString strItem = event.GetItem().GetText();
    wxString strNewLocation = strItem;
    if (strCurLocaitoin != _T("我的电脑"))
    {
        if (*strCurLocaitoin.rbegin() != _T('/'))
        {
            strCurLocaitoin.append(_T("/"));
        }
        strNewLocation = strCurLocaitoin.append(strItem);
    }
    TCHAR szPath[MAX_PATH];
    if (strItem == _T("..") && bIsRootLocation)
    {
        szPath[0] = 0;
    }
    else
    {
        CFilePathTool::GetInstance()->Canonical(szPath, strNewLocation.c_str());
    }    
    GetFileInfo(szPath, false);
}
开发者ID:beyondlwm,项目名称:Beats,代码行数:25,代码来源:SpyUserPanel.cpp


示例2: cOsdMenu

cFileInfoMenu::cFileInfoMenu(std::string mrl) : cOsdMenu( tr("File Info:"), 12)
{
	//set title
	//SetTitle(tr("mediaplayer - Id3 Info:"));
	mrl_ = mrl;
	fileInfoVec_ = GetFileInfo(mrl_);

	// Get title
	std::string title;
	TagLib::FileRef f( mrl.c_str() );
	if(!f.isNull() && f.tag())
	{
		TagLib::Tag *tag = f.tag();
								 // unicode = false
		title   = tag->title().stripWhiteSpace().toCString(false)  ;

		if (title.size())
		{
			char buffer[128];
			snprintf(buffer, 127, "File Info: %s", title.c_str());
			SetTitle(buffer);
			printf("setting title to : %s\n", buffer);
		}
	}

	ShowInfo();
}
开发者ID:suborb,项目名称:reelvdr,代码行数:27,代码来源:fileInfoMenu.c


示例3: while

///////////////////////////////////////////////////////////////////////////////
//
// Search for the target using the vPath
fileinfo* mhmakefileparser::SearchvPath(const fileinfo* pTarget)
{
  string TargetName=pTarget->GetName();
  vector< pair< string, refptr<fileinfoarray> > >::iterator vPathIt=m_vPath.begin();
  while (vPathIt!=m_vPath.end())
  {
    matchres Res;

    if (PercentMatch(TargetName,vPathIt->first,&Res))
    {
      fileinfoarray::iterator pIt=vPathIt->second->begin();
      while (pIt!=vPathIt->second->end())
      {
        fileinfo* pNewTarget=GetFileInfo(TargetName,*pIt);
        mh_time_t TargetDate=StartBuildTarget(pNewTarget,false);
        if (!TargetDate.IsDateValid())
          TargetDate=WaitBuildTarget(pNewTarget);
        if (pNewTarget->GetDate().DoesExist())
          return pNewTarget;
        pIt++;
      }
    }
    vPathIt++;
  }
  return NULL;
}
开发者ID:sheldonrobinson,项目名称:VcXsrv,代码行数:29,代码来源:mhmakefileparser.cpp


示例4: XLI_THROW_FILE_NOT_FOUND

        void UnixFileSystemBase::GetFiles(const String& path, Array<FileInfo>& list)
        {
            String prefix = 
                path.Length() > 0 && path.Last() != '/' ? 
                    path + "/" : 
                    path;

            DIR *dp;
            struct dirent *ep;

            if ((dp = opendir(prefix.Ptr())) == NULL)
                XLI_THROW_FILE_NOT_FOUND(prefix);

            if (prefix == "./")
                prefix = "";

            while ((ep = readdir(dp)) != NULL)
            {
                String fn = ep->d_name;
                
                if (fn == "." || fn == "..") 
                    continue;

                FileInfo info;
                if (GetFileInfo(prefix + fn, info))
                    list.Add(info);
            }

            closedir(dp);
        }
开发者ID:neodyme60,项目名称:Xli,代码行数:30,代码来源:UnixFileSystemBase.cpp


示例5: FindFirstFile

	FolderInfo FileSystem::GetFolderInfo(const String& path) const
	{
		FolderInfo res;
		res.path = path;

		WIN32_FIND_DATA f;
		HANDLE h = FindFirstFile(path + "/*", &f);
		if (h != INVALID_HANDLE_VALUE)
		{
			do
			{
				if (strcmp(f.cFileName, ".") == 0 || strcmp(f.cFileName, "..") == 0)
					continue;

				if (f.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY)
					res.folders.Add(GetFolderInfo(path + "/" + f.cFileName));
				else
					res.files.Add(GetFileInfo(path + "/" + f.cFileName));
			} while (FindNextFile(h, &f));
		}
		else
			mInstance->mLog->Error("Failed GetPathInfo: Error opening directory " + path);

		FindClose(h);

		return res;
	}
开发者ID:zenkovich,项目名称:o2,代码行数:27,代码来源:FileSystemImpl.cpp


示例6: nb_qfileinfo

int nb_qfileinfo(int handle)
{
    int     i;
    int     rc;
    char    FileName[128];
    char    temp[512];
    DWORD   gle;

    sprintf(FileName, "Thread_%05d.log", ProcessNumber);

    if ((i = FindHandle(handle)) == -1)
        return(-1);

    StartFirstTimer();
    rc = GetFileInfo(ftable[i].name, ftable[i].fd, NULL, NULL, NULL, NULL, NULL, NULL);
    gle = GetLastError();
    if (!rc)
    {
        EndFirstTimer(CMD_QUERY_FILE_INFO, 0);
        LeaveThread(0, "", CMD_QUERY_FILE_INFO);
        sprintf(temp, "File: qfileinfo failed for %s GLE(0x%x)\n", ftable[i].name, gle);
        if (verbose)
            printf("%s", temp);
        LogMessage(ProcessNumber, HostName, FileName, temp, LogID);
        return(-1);
    }
    EndFirstTimer(CMD_QUERY_FILE_INFO, 1);

    return(0);
}
开发者ID:snktagarwal,项目名称:openafs,代码行数:30,代码来源:nbio.c


示例7: GetFileList

	bool GetFileList(const string &sStoragePath, string &sOutResponse)
	{
		START_FUNCTION_BOOL();
		ASSERTE(!sStoragePath.empty());

		const sizeint siStoragePathLength = sStoragePath.length();

		string_v vsFilesList;
		sizeint siFilesCount = FileUtils::GetFileListRecursive(sStoragePath.c_str(), vsFilesList);

		string sResult;
		sizeint siEstimatedLength = (sStoragePath.length() + 1) * siFilesCount;
		sResult.reserve(siEstimatedLength);

		for (sizeint siIndex = 0; siIndex < siFilesCount; ++siIndex)
		{
			string &sCurrentFile = vsFilesList[siIndex];
			ASSERTE(sCurrentFile.length() > siStoragePathLength);

			string sFileInfo;
			if (GetFileInfo(sCurrentFile, sFileInfo))
			{
				string sCurrentFileItem = sCurrentFile.substr(siStoragePathLength) + sFileInfo;
				sResult.append(sCurrentFileItem);
			}
		}

		sOutResponse = sResult;
		END_FUNCTION_BOOL();
	}
开发者ID:starand,项目名称:cpp,代码行数:30,代码来源:CloudUtils.cpp


示例8: GetFileInfo

bool CZipArchive::ExtractFile(WORD uIndex, LPCTSTR lpszPath, DWORD nBufSize)
{
	if (!nBufSize)
		return false;
	
	CFileHeader header;
	GetFileInfo(header, uIndex); // to ensure that slash and oem conversions take place
	CString szFile = lpszPath;
	szFile.TrimRight(_T("\\"));
	szFile += _T("\\") + GetFileDirAndName(header.m_szFileName); // just in case in the archive there are file names with drives
	if (IsFileDirectory(uIndex))
	{
		ForceDirectory(szFile);
		SetFileAttributes(szFile, header.m_uExternalAttr);
	}
	else
	{
		if (!OpenFile(uIndex))
			return false;
		ForceDirectory(GetFilePath(szFile));
		CFile f(szFile, CFile::modeWrite | CFile::modeCreate | CFile::shareDenyWrite);
		DWORD iRead;
		CAutoBuffer buf(nBufSize);
		do
		{
			iRead = ReadFile(buf, buf.GetSize());
			if (iRead)
				f.Write(buf, iRead);
		}
		while (iRead == buf.GetSize());
		CloseFile(f);
	}	
	return true;
}
开发者ID:F5000,项目名称:spree,代码行数:34,代码来源:ZipArchive.cpp


示例9: GetFileInfo

bool FStreamingNetworkPlatformFile::IsReadOnly(const TCHAR* Filename)
{
	FFileInfo Info;
	GetFileInfo(Filename, Info);

	return Info.ReadOnly;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:7,代码来源:StreamingNetworkPlatformFile.cpp


示例10: AFCDirectoryOpen

// Finds the first file of a given directory. Must be used in conjunction with 
// the FindNext and FindClose methods. FindClose needn't be called if the call
// to FindFirst returned false.
//
// Returns:
//		true	if a file was found
//		false	if no file was found, or if there was an error
//
// Example:
//
//		CiPoTApi iPodApi;
//		t_iPodFileInfo info;
//		bool bFile;
//		t_iPodError status = iPodApi.OpenSession();
//
//		if (status == IPOD_ERR_OK) {
//			bFile = iPodApi.FindFirst(remotePath, &info);
//			while (bFile) {
//				printf("%s\n", info.findData.cFileName);
//				bFile = iPodApi.FindNext(&info);
//			}
//			iPodApi.FindClose(&info);
//
bool CiPoTApi::FindFirst(char *remotePath, t_iPodFileInfo *pInfo)
{
	t_AFCDirectory *pHandle;
	afc_error_t ret;
	char *pEntry;
	CMacPath MacPath;

	pInfo->pHandle = NULL;
	pInfo->remotePath = NULL;
	MacPath.SetWindowsPath(remotePath);
	ret = AFCDirectoryOpen(m_iPodConnection, MacPath.GetBuffer(), &pHandle);
	if (ret)
		return false;
	ret = AFCDirectoryRead(m_iPodConnection, pHandle, &pEntry);
	if (ret || pEntry == NULL) {
		// Broken link?
		AFCDirectoryClose(m_iPodConnection, pHandle);
		return false;
	}
	pInfo->remotePath = strdup(remotePath);
	pInfo->pHandle = pHandle;
	// Now, a special case with the Applications folder
	pInfo->appFolder = bTranslateApps && (
		!strcmp(remotePath, _T("\\User\\Applications")) ||
		!strcmp(remotePath, _T("\\var\\mobile\\Applications")) ||
		!strcmp(remotePath, _T("\\private\\var\\mobile\\Applications")));
	MacPath.SetString(pEntry);
	MacPath.GetWindowsPath(pInfo->findData.cFileName);
	GetFileInfo(0, pInfo);
	return true;
}
开发者ID:blitmaster,项目名称:T-PoT,代码行数:54,代码来源:iPoTApi.cpp


示例11: CoCreateInstance

HRESULT CMediaFileList::AddAudioFile(BSTR FilePath, IMediaFile **ppResult)
{
	HRESULT hr = CoCreateInstance(CLSID_MediaFile, NULL, 
							  CLSCTX_INPROC_SERVER, 
							  IID_IMediaFile, 
							  (void **)ppResult);

	if (FAILED(hr) || *ppResult == NULL)
		return E_POINTER;
	
	(*ppResult)->AddRef();
	(*ppResult)->put_FilePath(FilePath);
	
	double dDuration = 0;
	hr = GetFileInfo(FilePath, 0, &dDuration, 0, 0, 0, 0, 0, 0);
	
	if (SUCCEEDED(hr))
	{
		(*ppResult)->put_Duration(dDuration);
	}
	
	(*ppResult)->put_StartOffset(GetCurrentAudioLength());

	m_audioList.AddTail(*ppResult);
	
	(*ppResult)->AddRef();

	return S_OK;
}
开发者ID:BlackMael,项目名称:DirectEncode,代码行数:29,代码来源:MediaFileList.cpp


示例12: GetAvailableThemes

    static void GetAvailableThemes(std::vector<AvailableTheme> * outThemes)
    {
        Guard::ArgumentNotNull(outThemes, GUARD_LINE);

        outThemes->clear();

        NumPredefinedThemes = 0;
        for (auto predefinedTheme : PredefinedThemes)
        {
            AvailableTheme theme {};
            theme.Name = predefinedTheme.Theme->Name;
            outThemes->push_back(std::move(theme));

            NumPredefinedThemes++;
        }

        auto themesPattern = Path::Combine(GetThemePath(), "*.json");
        auto scanner = std::unique_ptr<IFileScanner>(Path::ScanDirectory(themesPattern, true));
        while (scanner->Next())
        {
            auto fileInfo = scanner->GetFileInfo();
            auto name = Path::GetFileNameWithoutExtension(std::string(fileInfo->Name));

            AvailableTheme theme {};
            theme.Name = name;
            theme.Path = GetThemeFileName(theme.Name);
            outThemes->push_back(std::move(theme));

            if (Path::Equals(CurrentThemePath, scanner->GetPath()))
            {
                ActiveAvailableThemeIndex = outThemes->size() - 1;
            }
        }
    }
开发者ID:Wirlie,项目名称:OpenRCT2,代码行数:34,代码来源:Theme.cpp


示例13: FileLoadDrivers

long
FileLoadDrivers( char * dirSpec, long plugin )
{
    long         ret, length, flags, time, bundleType;
    long long	 index;
    long         result = -1;
    const char * name;
 
    if ( !plugin )
    {
        // First try 10.6's path for loading Extensions.mkext.
        if (FileLoadMKext(dirSpec, "Caches/com.apple.kext.caches/Startup/") == 0)
            return 0;

        // Next try the legacy path.
        else if (FileLoadMKext(dirSpec, "") == 0)
          return 0;

        strcat(dirSpec, "Extensions");
    }

    index = 0;
    while (1) {
        ret = GetDirEntry(dirSpec, &index, &name, &flags, &time);
        if (ret == -1) break;

        // Make sure this is a directory.
        if ((flags & kFileTypeMask) != kFileTypeDirectory) continue;
        
        // Make sure this is a kext.
        length = strlen(name);
        if (strcmp(name + length - 5, ".kext")) continue;

        // Save the file name.
        strcpy(gFileName, name);
    
        // Determine the bundle type.
        sprintf(gTempSpec, "%s/%s", dirSpec, gFileName);
        ret = GetFileInfo(gTempSpec, "Contents", &flags, &time);
        if (ret == 0) bundleType = kCFBundleType2;
        else bundleType = kCFBundleType3;

        if (!plugin)
            sprintf(gDriverSpec, "%s/%s/%sPlugIns", dirSpec, gFileName,
                    (bundleType == kCFBundleType2) ? "Contents/" : "");

        ret = LoadDriverPList(dirSpec, gFileName, bundleType);

        if (result != 0)
          result = ret;

        if (!plugin) 
          FileLoadDrivers(gDriverSpec, 1);
    }

    return result;
}
开发者ID:JayMonkey,项目名称:chameleon,代码行数:57,代码来源:drivers.c


示例14: GetFileInfo

int KHttpFile::Download()
{
    int nRetCode    = false;
    int nResult     = false;
    int nRetryCount = 0;

    nRetCode = GetFileInfo();
    KGLOG_PROCESS_ERROR(nRetCode);

    while (nRetryCount <= 5)
    {
        if (m_nFileSize == m_nDownloadedSize)
        {
            m_nErrorCode = dec_err_success;
            goto Exit1;
        }

        nRetCode = m_Downloader.Download(m_strUrl.c_str(), m_strFile.c_str());
        switch(nRetCode)
        {
        case HTTP_RESULT_SUCCESS:
        case HTTP_RESULT_SAMEAS:
            m_nErrorCode = dec_err_success;
            goto Exit1;
            break;

        case HTTP_RESULT_STOP:
            m_nErrorCode = dec_err_stop;
            goto Exit0;
            break;

        case HTTP_RESULT_FAIL:
            m_nErrorCode = dec_err_disconnection;
            KGLogPrintf(KGLOG_INFO, "disconnection retry %d", nRetryCount++);
            Sleep(5000);
            break;

        case HTTP_RESULT_REDIRECT_FTP:
        case HTTP_RESULT_REDIRECT_HTTP:
            m_nErrorCode = dec_err_cannotconnect;
            KGLogPrintf(KGLOG_INFO, "cannotconnect retry %d", nRetryCount++);
            Sleep(5000);
            break;

        default:
            m_nErrorCode = dec_err_cannotconnect;
            KGLOG_PROCESS_ERROR(false && "unknow result");
            break;
        }
    }

Exit1:
    nResult = true;
Exit0:
    KGLogPrintf(KGLOG_INFO, "download result= %d, filename = %s", m_nErrorCode, m_strFile.c_str());
    return nResult;
}
开发者ID:viticm,项目名称:pap2,代码行数:57,代码来源:KHttpFile.cpp


示例15: GetModificationTime

CDateTime CLocalFileSystem::GetModificationTime( const wxString& path)
{
	CDateTime mtime;

	bool tmp;
	if (GetFileInfo(path, tmp, 0, &mtime, 0) == unknown)
		mtime = CDateTime();

	return mtime;
}
开发者ID:Typz,项目名称:FileZilla,代码行数:10,代码来源:local_filesys.cpp


示例16: GetFileInfo

// This is called once for each output line.
// In this example the input data is obtained pixel by pixel from the input image
// using the GetPixel method of the GDI+ Bitmap object created from the source image
// file above.
//
CNCSError ECWDEMCompressor::WriteReadLine(UINT32 nNextLine, void **ppInputArray)
{
    CNCSError Error = NCS_SUCCESS;
    NCSFileViewFileInfoEx *pInfo = GetFileInfo();

    IFECW->WriteReadLineCallback(nNextLine, ppInputArray, pInfo->nSizeX, pInfo->eCellType);

    return NCS_SUCCESS;

} // ECWDEMCompressor::WriteReadLine
开发者ID:AlphaPixel,项目名称:3DNature,代码行数:15,代码来源:ImageFormatECWDEM.cpp


示例17: GetFileInfo

BOOL CUnzipper::GetFileInfo(int nFile, UZ_FileInfo& info)
{
	if (!m_uzFile)
		return FALSE;

	if (!GotoFile(nFile))
		return FALSE;

	return GetFileInfo(info);
}
开发者ID:afrozm,项目名称:projects,代码行数:10,代码来源:Unzipper.cpp


示例18: GetFileInfo

FileWatcher::FileEventFlags FileWatcher::Worker::UpdateFileInfo(boost::filesystem::path path)
{
	FileEventFlags flags = FileEventFlags::Nothing;
	if (boost::filesystem::exists(path))
	{
		FileInfo fi = GetFileInfo(path);
		auto lastFileInfoIt = m_FileInfo.find(path);
		if (lastFileInfoIt != m_FileInfo.end())
		{
			FileInfo lastFileInfo = lastFileInfoIt->second;

			if (fi.Size != lastFileInfo.Size)
			{
				LOG_DEBUG("FileWatcher: \"%s\" size changed!", path.string().c_str());
				flags = flags | FileEventFlags::SizeChanged;
			}
			if (fi.Timestamp != lastFileInfo.Timestamp)
			{
				LOG_DEBUG("FileWatcher: \"%s\" timestamp changed!", path.string().c_str());
				flags = flags | FileEventFlags::TimestampChanged;

			}
		}
		else
		{
			LOG_DEBUG("FileWatcher: \"%s\" was created!", path.string().c_str());
			flags = flags | FileEventFlags::Created;
		}
		m_FileInfo[path] = GetFileInfo(path);
	}
	else
	{
		auto fileInfoIt = m_FileInfo.find(path);
		if (fileInfoIt != m_FileInfo.end())
		{
			m_FileInfo.erase(fileInfoIt);
			LOG_DEBUG("FileWatcher: \"%s\" was deleted!", path.string().c_str());
			flags = flags | FileEventFlags::Deleted;
		}
	}
	return flags;
}
开发者ID:FakeShemp,项目名称:TacticalZ,代码行数:42,代码来源:FileWatcher.cpp


示例19: GetFileInfo

wxLongLong CLocalFileSystem::GetSize(wxString const& path, bool* isLink)
{
	wxLongLong ret = -1;
	bool tmp{};
	local_fileType t = GetFileInfo(path, isLink ? *isLink : tmp, &ret, 0, 0);
	if( t != file ) {
		ret = -1;
	}

	return ret;
}
开发者ID:Typz,项目名称:FileZilla,代码行数:11,代码来源:local_filesys.cpp


示例20: _T

bool CServerFileManageHandle::DowndFileDir(LPCWSTR szPath, LPCWSTR szRemote)
{
	std::wstring strPath = szRemote;
	
	if( szPath[lstrlen(szPath) -1] != _T('\\') )
		strPath +=  _T("\\");
	{{
		std::wstring strPath = szPath;
		if( szPath[lstrlen(szPath) -1] != _T('\\') )
			strPath +=  _T("\\");
		BOOL bOK = CreateDirectory(strPath.c_str(), NULL);
		if(!bOK)
			return false;
	}}
	
	File_Info_Vector Vector;
	bool bIsOk = GetFileInfo(strPath.c_str(), &Vector);
	if(!bIsOk)
		return false;
	DWORD dwFileCount = Vector.size();
	for(DWORD i = 0; i < Vector.size(); i++)
	{
		if(lstrcmp(Vector[i].cFileName, _T(".")) == 0)
			continue;
		if(lstrcmp(Vector[i].cFileName, _T("..")) == 0)
			continue;			
		std::wstring strPath = szPath;
		if( szPath[lstrlen(szPath) -1] != _T('\\') )
			strPath +=  _T("\\");

		std::wstring strRemote = szRemote;
		if( szRemote[lstrlen(szRemote) -1] != _T('\\') )
			strRemote +=  _T("\\");
		if(Vector[i].bIsDir)
		{
			strPath +=  Vector[i].cFileName;
			strPath +=  _T("\\");
			strRemote += Vector[i].cFileName;
			strRemote +=  _T("\\");
			bIsOk = DowndFileDir(strPath.c_str(), strRemote.c_str());
			if(!bIsOk)
				return false;
		}
		else
		{
			strPath +=  Vector[i].cFileName;
			strRemote += Vector[i].cFileName;
			bIsOk = DowndFile(strPath.c_str(), strRemote.c_str());
			if(!bIsOk)
				return false;
		}
	}
	return true;
}
开发者ID:hanggithub,项目名称:vipshell,代码行数:54,代码来源:ServerFileManageHandle.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetFileInformationByHandle函数代码示例发布时间:2022-05-30
下一篇:
C++ GetFileAttributesW函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap