调试程序的Debug版本,出现断言框,定位于库文件findfile.cpp 第369行: 

void CFileFind::AssertValid() const
{
// if you trip the ASSERT in the else side, you've called
// a Get() function without having done at least one
// FindNext() call if (m_hContext == NULL)
ASSERT(m_pFoundInfo == NULL && m_pNextInfo == NULL);
else
ASSERT(m_pFoundInfo != NULL && m_pNextInfo != NULL); // 第369行
}

  原程序:

CFileFind finder;
if(finder.FindFile(filename))
{
CString str = findfile.GetRoot();
// do something ...
}

  修改后:

CFileFind finder;
if(finder.FindFile(filename))
{
findfile.FindNextFile();
CString str = findfile.GetRoot();
// do something ...
}

  正确的调用的次序应该是:FindFile,FindNextFile,GetFileName/GetRoot

  扩展:BOOL CFileFind::FindNextFile

BOOL CFileFind::FindNextFile()
{
ASSERT(m_hContext != NULL); if (m_hContext == NULL)
return FALSE;
if (m_pFoundInfo == NULL)
m_pFoundInfo = new WIN32_FIND_DATA; ASSERT_VALID(this); void* pTemp = m_pFoundInfo;
m_pFoundInfo = m_pNextInfo;
m_pNextInfo = pTemp; return ::FindNextFile(m_hContext, (LPWIN32_FIND_DATA) m_pNextInfo);
}

  以下是MSDN中对于FindNextFile的说明:

  Call this member function to continue a file search from a previous call to FindFile. 

  You must call FindNextFile at least once before calling any of the following attribute member functions:

    •   GetCreationTime

    •   GetFileName

    •   GetFileTitle

    •   GetFilePath

    •   GetFileURL

    •   GetLastAccessTime

    •   GetLastWriteTime

    •   GetLength

    •   GetRoot

    •   IsArchived

    •   IsCompressed

    •   IsDirectory

    •   IsDots

    •   IsHidden

    •   IsNormal

    •   IsReadOnly

    •   IsSystem

    •   IsTemporary

    •   MatchesMask

VC++:Debug出错,提示错误在findfile.cpp (Line 369)的更多相关文章

  1. Sqlserver2005附加数据库时出错提示操作系统错误5(拒绝访问)错误5120的解决办法

    Sqlserver2005附加数据库时出错提示操作系统错误5(拒绝访问)错误5120的解决办法 最近几天从网上找了几个asp.net的登录案例想要研究研究代码,结果在用 Sql Server2005附 ...

  2. SQLServer2005+附加数据库时出错提示操作系统错误5(拒绝访问)错误5120的解决办法

    SQLServer2005+ 附加数据库时出错提示操作系统错误5(拒绝访问)错误5120的解决办法 我们在用Sql SQLServer2005+附加数据库文件时弹出错误信息如下图的处理办法: 方案一: ...

  3. 远程桌面控制winsever,复制文件或者文件夹夹时出错提示“未指定的错误” 二(如何让远程电脑识别U盘)

    一.背景:   要给远程服务器安装数据库,把安装复制到服务器,出现复制文件或者文件夹夹时出错提示“未指定的错误”:通过映射网络分享文件方法来解决,发现服务器访问网络出现错误,ping分享文件电脑的IP ...

  4. [经使用有效]Sqlserver2005附加数据库时出错提示操作系统错误5(拒绝访问)错误5120的解决办法

    sqlserver2005附加数据库时出错提示操作系统错误5(拒绝访问)错误5120的解决办法 最近几天从网上找了几个asp.net的登录案例想要研究研究代码,结果在用 Sql Server2005附 ...

  5. VC Debug和Release区别

    https://msdn.microsoft.com/en-us/library/xz7ttk5s.aspx   Optimizing Your Code Visual Studio 2015 The ...

  6. Eclipse导入项目时出错提示 project is missing required library

    Eclipse导入(import)项目时出错提示 project is missing required library... 以至于不能build... 然后项目会有红色感叹号: [解决办法] 右击 ...

  7. Oracle登录时提示错误,导致用户无法登录

    Oracle登录时提示错误,导致用户无法登录,错误如下 ------------------------------------------------------------------------ ...

  8. WCF 在VS中,添加服务引用,地址输入http://ip/Service.svc,点击前往,提示错误,内容如下:

    WCF的service端的webconfig如下: <?xml version="1.0"?> <configuration> <system.ser ...

  9. maven的pom 提示错误 Failure to transfer com.thoughtworks.xstream:xstream:jar:

    pom文件提示错误,信息如下 Description    Resource    Path    Location    TypeFailure to transfer com.thoughtwor ...

随机推荐

  1. 史上最全的CDN内容分发网络实战技巧(网络优化)

    今天来给大家分享下关于 CDN 的东西,以及我自己的一些发现.一些个人的拙见.总共分为 3 个部分:原理.详解.各种坑. 首先说一下 CDN 的基本原理部分,主要分 4 块来描述:CDN 的由来.调度 ...

  2. 基于jQuery+ashx+.net实现三级栏目联动操作

    父级ID可以为空以两个编号为一级 可以添加到第四级 table 字段有ID. name .parentNode. childNode等基本属性  selecet  parentNode  ,len(c ...

  3. 解决MAC下xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)的问题

    将系统升级到了最新10.13.3 macOS High Sierra后,在使用ctags命令时会出现如下问题: xcrun: error: invalid active developer path ...

  4. LoadRunner Controller 常见用法

    Controller 工作原理:通过场景设计来模拟用户的真实操作并调用vugen中的脚本,再通过设置的压力机产生压力 Scenario-convert scenario to the percenta ...

  5. centos 手动编译 fcitx 各种问题大全

    yum install ncurses-devel   tinyxml-devel sqlite-devel wget http://downloads.sourceforge.net/project ...

  6. AngularJS实现跨域请求

    跨域,前端开发中经常遇到的问题,AngularJS实现跨域方式类似于Ajax,使用CORS机制. 下面阐述一下AngularJS中使用$http实现跨域请求数据. AngularJS XMLHttpR ...

  7. vue的面包屑导航组件

    用来将其放到navbar中: Breadcrumb/index.vue <template> <el-breadcrumb class="app-breadcrumb&qu ...

  8. js屏蔽键盘按键

    3.1屏蔽键盘所有键 <script language="javascript"> <!-- function document.onkeydown(){ eve ...

  9. LeetCode: Permutations 解题报告

    Permutations Given a collection of numbers, return all possible permutations. For example,[1,2,3] ha ...

  10. SharePoint自动化系列——通过PowerShell创建SharePoint Lists

    转载请注明出自天外归云的博客园:http://www.cnblogs.com/LanTianYou/ 代码如下(保存到本地ps1文件中,右键run with PowerShell即可): Add-PS ...