zoukankan      html  css  js  c++  java
  • 区别 cfilefind 的三个查询方法 GetFileName (),GetFilePath(),GetFileTitle()


    • http://msdn.microsoft.com/zh-cn/library/ttex48b8.aspx

      GetFileName is one of three CFileFind member functions that return some form of the file name. The following list describes the three and how they vary:

      • GetFileName returns the file name, including the extension. For example, calling GetFileName to generate a user message about the file c:\myhtml\myfile.txt returns the file namemyfile.txt.

      • GetFilePath returns the entire path for the file. For example, calling GetFilePath to generate a user message about the file c:\myhtml\myfile.txt returns the file pathc:\myhtml\myfile.txt.

      • GetFileTitle returns the file name, excluding the file extension. For example, calling GetFileTitle to generate a user message about the file c:\myhtml\myfile.txt returns the file titlemyfile.

        CFileFind finder;
        static const TCHAR szFileToFind[] = _T("C:\\WINDOWS\\SYSTEM.INI");
        
        BOOL bResult = finder.FindFile(szFileToFind);
        
        if (bResult)
        {
           finder.FindNextFile();
        
           TRACE(_T("Root of %s is %s\n"), szFileToFind, 
              (LPCTSTR)finder.GetRoot());
        
           TRACE(_T("Title of %s is %s\n"), szFileToFind, 
              (LPCTSTR)finder.GetFileTitle());
        
           TRACE(_T("Path of %s is %s\n"), szFileToFind,
              (LPCTSTR)finder.GetFilePath());
        
           TRACE(_T("URL of %s is %s\n"), szFileToFind,
              (LPCTSTR)finder.GetFileURL());
        
           TRACE(_T("Name of %s is %s\n"), szFileToFind,
              (LPCTSTR)finder.GetFileName());
        
           finder.Close();
        }
        else
        {
           TRACE(_T("You have no %s file.\n"), szFileToFind);
        }
        

  • 相关阅读:
    DM7 安装
    LeetCode 第 183 场周赛
    MySQL 源码中的 ut_a 、 ut_ad
    存储领域的会议和研究机构
    LeetCode 第 15 场双周赛
    LeetCode 第 167 场周赛
    值得推荐的C/C++框架和库
    InnoDB 中的锁实现
    LeetCode-第 166 场周赛
    LeetCode 第 165 场周赛
  • 原文地址:https://www.cnblogs.com/gdutbean/p/2139511.html
Copyright © 2011-2022 走看看