Example

CFileFind finder;
static const TCHAR szFileToFind[] = _T("C:\\WINDOWS\\SYSTEM.INI");

BOOL bResult = finder.FindFile(szFileToFind);

if (bResult)
{
   finder.FindNextFile();

   cout << "Root of " << szFileToFind;
   cout << " is " << (LPCTSTR) finder.GetRoot();
   cout << endl;

   cout << "Title of " << szFileToFind;
   cout << " is " << (LPCTSTR) finder.GetFileTitle();
   cout << endl;

   cout << "Path of " << szFileToFind;
   cout << " is " << (LPCTSTR) finder.GetFilePath();
   cout << endl;

   cout << "URL of " << szFileToFind;
   cout << " is " << (LPCTSTR) finder.GetFileURL();
   cout << endl;

   cout << "Name of " << szFileToFind;
   cout << " is " << (LPCTSTR) finder.GetFileName();
   cout << endl;

   finder.Close();
}
else
   cout << "You have no " << szFileToFind << " file." << endl;

Example Output

Assumes that the file C:\WINDOWS\SYSTEM.INI exists:

Root of C:\WINDOWS\SYSTEM.INI is C:\WINDOWS
Title of C:\WINDOWS\SYSTEM.INI is SYSTEM
Path of C:\WINDOWS\SYSTEM.INI is C:\WINDOWS\SYSTEM.INI
URL of C:\WINDOWS\SYSTEM.INI is file://C:\WINDOWS\SYSTEM.INI
Name of C:\WINDOWS\SYSTEM.INI is SYSTEM.INI

相关文章:

  • 2022-12-23
  • 2022-03-07
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2021-09-17
  • 2021-08-16
  • 2022-02-05
猜你喜欢
  • 2022-12-23
  • 2022-02-19
  • 2022-01-14
  • 2021-10-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案