unhandled exception!

xiaoche88 2010-12-09 09:20:39
void CSoilDlg::Traversal(CString path)
{
CString file_pathL,file_pathR;
SetCurrentDirectory(path);
CFileFind finder;
BOOL bWorking = finder.FindFile("*.*");
while (bWorking)
{
bWorking = finder.FindNextFile();
if(finder.IsDirectory() && !finder.IsDots())
{
path=finder.GetFilePath();
path+='\\';
Traversal(path);
}
else
{
if(finder.IsDots())
continue;

file_pathL=finder.GetFilePath();


if(!bWorking)
break;
else
{
bWorking = finder.FindNextFile();
file_pathR=finder.GetFilePath();

//将左旋文件的路径保存在FilePathL中
//将右旋文件的路径保存在FilePathR中
CString str,str1;
str1=file_pathL.Left((file_pathL.ReverseFind('.'))).Right(1);
if(str1=="R")
{
str=file_pathL;
file_pathL=file_pathR;
file_pathR=str;
}
DataProcess(file_pathL,file_pathR);
}
}

}

path=path.Left(path.ReverseFind('\\'));
path=path.Left(path.ReverseFind('\\'));
// path+='\\';
SetCurrentDirectory(path);

}


这是一个递归调用,遍历超找某路径下,所有文件夹下的所有文件并处理。
单步调试的时候,会弹出如下提示,“Unhandled exception in ***。exe:0x000005:Access Violation”
全速运行的时候又会出现内存不能为读的错误提示。
哎,我都快崩溃了!!!
求大侠相助!!!!!!!!
...全文
315 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

69,364

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧