当前位置:网站首页>_findnext 报错
_findnext 报错
2022-04-23 05:50:00 【ppipp1109】
ps:编译环境 qt + mingw32 编译没问题;
换到qt + msvc 2017_64 就出现问题;
报错信息:
Stopped in thread 0 by: Exception at 0x7ffbcfe713ad, code: 0xc0000005: write access violation at: 0xffffffffd587d380, flags=0x0 (first chance).
//获取目录下的所有文件名
void getFiles(string path, vector<string>& files)
{
//文件句柄
long hFile = 0;
//文件信息
struct _finddata_t fileinfo;
string p;
if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo)) != -1)
{
do
{
//如果是目录,迭代之
//如果不是,加入列表
if ((fileinfo.attrib & _A_SUBDIR))
{
if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0)
getFiles(p.assign(path).append("\\").append(fileinfo.name), files);
}
else
{
files.push_back(p.assign(path).append("\\").append(fileinfo.name));
}
} while (_findnext(hFile, &fileinfo) == 0);
_findclose(hFile);
}
}
应用下面这个函数的时候, 报错上面的错误。折腾了一下午,起初以为是编码格式问题,最后发现是64位编译器,反馈的结构体的值保存的是64位,定义的 long 型hFile 会被截断,对不上了。
所以将long hfile 改为
intptr_t hFile
或者
long long hFIle
版权声明
本文为[ppipp1109]所创,转载请带上原文链接,感谢
https://ppipp.blog.csdn.net/article/details/124328853
边栏推荐
- gcc ,g++,gdb的安装
- For() loop parameter call order
- 【UDS统一诊断服务】一、诊断概述(2)— 主要诊断协议(K线和CAN)
- [UDS unified diagnostic service] III. application layer protocol (1)
- 【UDS统一诊断服务】四、诊断典型服务(3)— 读故障信息功能单元(存储数据传输功能单元)
- 【学习一下】HF-Net 训练
- Matlab calibration board corner detection principle
- Qt 添加QSerialPort类 实现串口操作
- Arcpy为矢量数据添加字段与循环赋值
- 在MFC中使用printf
猜你喜欢

for()循环参数调用顺序
![[UDS unified diagnostic service] IV. typical diagnostic service (5) - function / component test function unit (routine function unit 0x31)](/img/98/becd691d3d46f74f7666f5cb323eaf.png)
[UDS unified diagnostic service] IV. typical diagnostic service (5) - function / component test function unit (routine function unit 0x31)
![[UDS unified diagnosis service] IV. typical diagnosis service (3) - read fault information function unit (storage data transmission function unit)](/img/10/bd39bb03f5456a412650596208a391.png)
[UDS unified diagnosis service] IV. typical diagnosis service (3) - read fault information function unit (storage data transmission function unit)

The most practical chrome plug-in

OpenCV使用 GenericIndex 进行 KNN 搜索

【UDS统一诊断服务】一、诊断概述(4)— 基本概念和术语

C语言循环结构程序

拷贝构造函数

安装pyshp库

Call procedure of function
随机推荐
使用TransmittableThreadLocal实现参数跨线程传递
ArcGIS表转EXCEL超出上限转换失败
基于QQwebAPI 查询昵称和头像的爬虫
带默认模板实参的类模板与模板模板形参的匹配
客户端软件增量更新
[ThreadX] h743 + ThreadX + Filex migration record
C#【文件操作篇】按行读取txt文本
PHP junior programmers, take orders and earn extra money
进程间通信-互斥锁
用C语言实现重写strcmp等四个函数
Graduation project, viewing screenshots of epidemic psychological counseling system
C语言的浪漫
[ThreadX] ThreadX source code reading plan (I)
Protection of shared data
1006 finding a mex (hdu6756)
【OpenCV】使用 FileStorage 读写 Eigen 向量
[UDS unified diagnostic service] IV. typical diagnostic service (2) - data transmission function unit
Matching between class template with default template argument and template parameter
Matlab标定板角点检测原理
gst-launch-1.0用法小记