VC++:Debug出错,提示错误在findfile.cpp (Line 369)
调试程序的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)的更多相关文章
- Sqlserver2005附加数据库时出错提示操作系统错误5(拒绝访问)错误5120的解决办法
Sqlserver2005附加数据库时出错提示操作系统错误5(拒绝访问)错误5120的解决办法 最近几天从网上找了几个asp.net的登录案例想要研究研究代码,结果在用 Sql Server2005附 ...
- SQLServer2005+附加数据库时出错提示操作系统错误5(拒绝访问)错误5120的解决办法
SQLServer2005+ 附加数据库时出错提示操作系统错误5(拒绝访问)错误5120的解决办法 我们在用Sql SQLServer2005+附加数据库文件时弹出错误信息如下图的处理办法: 方案一: ...
- 远程桌面控制winsever,复制文件或者文件夹夹时出错提示“未指定的错误” 二(如何让远程电脑识别U盘)
一.背景: 要给远程服务器安装数据库,把安装复制到服务器,出现复制文件或者文件夹夹时出错提示“未指定的错误”:通过映射网络分享文件方法来解决,发现服务器访问网络出现错误,ping分享文件电脑的IP ...
- [经使用有效]Sqlserver2005附加数据库时出错提示操作系统错误5(拒绝访问)错误5120的解决办法
sqlserver2005附加数据库时出错提示操作系统错误5(拒绝访问)错误5120的解决办法 最近几天从网上找了几个asp.net的登录案例想要研究研究代码,结果在用 Sql Server2005附 ...
- VC Debug和Release区别
https://msdn.microsoft.com/en-us/library/xz7ttk5s.aspx Optimizing Your Code Visual Studio 2015 The ...
- Eclipse导入项目时出错提示 project is missing required library
Eclipse导入(import)项目时出错提示 project is missing required library... 以至于不能build... 然后项目会有红色感叹号: [解决办法] 右击 ...
- Oracle登录时提示错误,导致用户无法登录
Oracle登录时提示错误,导致用户无法登录,错误如下 ------------------------------------------------------------------------ ...
- WCF 在VS中,添加服务引用,地址输入http://ip/Service.svc,点击前往,提示错误,内容如下:
WCF的service端的webconfig如下: <?xml version="1.0"?> <configuration> <system.ser ...
- maven的pom 提示错误 Failure to transfer com.thoughtworks.xstream:xstream:jar:
pom文件提示错误,信息如下 Description Resource Path Location TypeFailure to transfer com.thoughtwor ...
随机推荐
- zuul超时及重试配置1
eureka: client: register-with-eureka: true serviceUrl: defaultZone: http://localhost:8761/eureka/ se ...
- linux没有那个文件或目录
linux脚本执行 报错 没有那个文件或目录 但是ls 看一下,明明有文件 原因: vim filename然后用命令 :set ff可看到dos或unix的字样,如果的确是dos格式的, 那么用se ...
- JSP/Servlet中文乱码处理总结
下面的任何一条缺一不可,注意,我之所以全部都用的XXX,意思就是这几个最好全部都一致! 1.HTML中要用meta content="text/html; charset=XXX" ...
- 在eclipse中配置server和database
配置server,以tomcat为例 点击下图的tag 如果没有,就去这里找: 然后右键:new->server,根据你安装的server选择版本,然后finish就行了 然后你右键那个serv ...
- Celery+python+redis异步执行定时任务
我之前的一篇文章中写了[Celery+django+redis异步执行任务] 博文:http://blog.csdn.net/apple9005/article/details/54236212 你会 ...
- c# 创建socket客户端
c# 创建socket客户端 using System; using System.Collections.Generic; using System.Linq; using System.Text; ...
- 基于jQuery左右滑动切换图片代码
分享一款基于jQuery左右滑动切换图片代码.这是一款基于jQuery实现的左右滑动切换焦点图代码.效果图如下: 在线预览 源码下载 实现的代码: <div class="v_ou ...
- Ubuntu 下查看中文man手册方法
转载自:http://blog.chinaunix.net/uid-24830506-id-3266493.html Ubuntu 中文man手册安装方法 分类: LINUX Ubuntu 下查看中文 ...
- java父子进程通信
1.利用进程的管道通信传输流 2.子进程没有控制台,正常测试的时候也是没办法看到子进程的输出的,需要传到主线程 3.测试主进程传参给子进程再传回来 4.父进程启动子进程只要执行runtime.exec ...
- BF + KMP + BM 字符串搜索算法
BF #include <stdio.h> #include <string.h> int simplicity(char *s, char *t, int pos); int ...