这篇教程C++ GetFileInfo函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetFileInfo函数的典型用法代码示例。如果您正苦于以下问题:C++ GetFileInfo函数的具体用法?C++ GetFileInfo怎么用?C++ GetFileInfo使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetFileInfo函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: _Tvoid 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,
示例2: cOsdMenucFileInfoMenu::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,
示例3: while/////////////////////////////////////////////////////////////////////////////////// Search for the target using the vPathfileinfo* 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,
示例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,
示例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,
示例6: nb_qfileinfoint 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,
示例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,
示例8: GetFileInfobool 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,
示例9: GetFileInfobool FStreamingNetworkPlatformFile::IsReadOnly(const TCHAR* Filename){ FFileInfo Info; GetFileInfo(Filename, Info); return Info.ReadOnly;}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:7,
示例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,
示例11: CoCreateInstanceHRESULT 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,
示例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,
示例13: FileLoadDriverslongFileLoadDrivers( 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,
示例14: GetFileInfoint 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,
示例15: GetModificationTimeCDateTime 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,
示例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,
示例17: GetFileInfoBOOL CUnzipper::GetFileInfo(int nFile, UZ_FileInfo& info){ if (!m_uzFile) return FALSE; if (!GotoFile(nFile)) return FALSE; return GetFileInfo(info);}
开发者ID:afrozm,项目名称:projects,代码行数:10,
示例18: GetFileInfoFileWatcher::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,
示例19: GetFileInfowxLongLong 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,
示例20: _Tbool 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,
示例21: bpathvoid FileWatcher::Worker::AddWatch(std::string path, FileEventCallback_t callback){ m_Mutex.lock(); boost::filesystem::path bpath(path); m_FileCallbacks[bpath] = callback; if (boost::filesystem::exists(bpath)) { m_FileInfo[bpath] = GetFileInfo(bpath); } m_Mutex.unlock();}
开发者ID:FakeShemp,项目名称:TacticalZ,代码行数:11,
示例22: LogExceptionvoid LogException(BadCodeException &e) { try { auto info = GetFileInfo(e.location); std::cerr << info.generateReport(e.message) << std::endl; } catch (InternalCompilerError &ice) { std::cerr << ice.message << " The error was: '" << e.message << "'" << std::endl; } catch (...) { std::cerr << "There was an error in the above program." << std::endl; // And the above compiler, apparently }}
开发者ID:epilk,项目名称:Rattler,代码行数:12,
示例23: GetFileInfo//根据MD5值返回文件全路径acl::string CResourceMgr::GetFileFullPath(acl::string md5){ acl::string info = GetFileInfo(md5); std::vector<acl::string> vField = info.split2(SPLITOR_OF_FILE_INFO); if (vField.size() > 3) { //key:md5, value:文件名|文件路径|MD5|文件大小 return vField[1]; } return "";}
开发者ID:foxbryant88,项目名称:P2PSharer,代码行数:14,
示例24: GetLoggerbool Buffer::LoadFromFile(std::string filename, SoundType sound){ m_sound = sound; GetLogger()->Debug("Loading audio file: %s/n", filename.c_str()); auto file = CResourceManager::GetSNDFileHandler(filename); GetLogger()->Trace(" channels %d/n", file->GetFileInfo().channels); GetLogger()->Trace(" format %d/n", file->GetFileInfo().format); GetLogger()->Trace(" frames %d/n", file->GetFileInfo().frames); GetLogger()->Trace(" samplerate %d/n", file->GetFileInfo().samplerate); GetLogger()->Trace(" sections %d/n", file->GetFileInfo().sections); if (!file->IsOpen()) { GetLogger()->Warn("Could not load file %s. Reason: %s/n", filename.c_str(), file->GetLastError().c_str()); m_loaded = false; return false; } alGenBuffers(1, &m_buffer); if (CheckOpenALError()) { GetLogger()->Warn("Could not create audio buffer. Code: %d/n", GetOpenALErrorCode()); m_loaded = false; return false; } // read chunks of 4096 samples std::vector<uint16_t> data; std::array<int16_t, 4096> buffer; data.reserve(file->GetFileInfo().frames); std::size_t read = 0; while ((read = file->Read(buffer.data(), buffer.size())) != 0) { data.insert(data.end(), buffer.begin(), buffer.begin() + read); } ALenum format = file->GetFileInfo().channels == 1 ? AL_FORMAT_MONO16 : AL_FORMAT_STEREO16; alBufferData(m_buffer, format, &data.front(), data.size() * sizeof(uint16_t), file->GetFileInfo().samplerate); m_duration = static_cast<float>(file->GetFileInfo().frames) / file->GetFileInfo().samplerate; m_loaded = true; return true;}
开发者ID:BTML,项目名称:colobot,代码行数:44,
注:本文中的GetFileInfo函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetFileInformationByHandle函数代码示例 C++ GetFileAttributesW函数代码示例 |