[捉蟲記錄] access violation writing location _findnext
jeremy lin
在Windows 10中VS2013下執行如下程式:
void getFiles(string path, vector<string>& files)
{
long hFile = 0;
// _finddata_t ÊÇÓÃÀ´´æ´¢Îļþ¸÷ÖÖÐÅÏ¢µÄ½á¹¹Ìå
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)
{
files.push_back(p.assign(path).append("\\").append(fileinfo.name));
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);
}
}
void getFilesFormat(string path, vector<string>& files, string format)
{
//long hFile = 0;
intptr_t hFile = 0;
struct _finddata_t fileinfo;
string p;
if ((hFile = _findfirst(p.assign(path).append("\\*" + format).c_str(), &fileinfo)) != -1)
{
do
{
if ((fileinfo.attrib & _A_SUBDIR))
{
if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0)
{
getFilesFormat(p.assign(path).append("\\").append(fileinfo.name), files, format);
}
}
else
{
files.push_back(p.assign(path).append("\\").append(fileinfo.name));
}
} while (_findnext(hFile, &fileinfo) == 0);
_findclose(hFile);
}
}
報如下錯誤:
access violation writing location
note:在win10 vs2015情況下執行程式未報錯。
解決方案:
把long hFile改成 intptr_t hFile
相關文章
- [捉蟲記錄]關於Cascade Training Error的bugAIError
- Web伺服器捉蟲速記Web伺服器
- W32DASM8.93捉蟲記 湖北 wuhuashangASM
- Delphi常見的執行期Access Violation錯誤分析
- 捉蟲記之dozer對映父類屬性被重寫
- 子執行緒 UI 問題捉蟲執行緒UI
- 【Xtrabackup捉蟲】Waiting for master thread to be suspendedAIASTthread
- ACCESS 回到重新整理之前的記錄
- 解決laravel出現Syntax error or access violation: 1055 ‘***‘ isn‘t in GROUP BYLaravelError
- MySQL·捉蟲動態·唯一鍵約束失效MySql
- ACCESS 統計報表有多少行記錄
- 執行遷移檔案報錯: Syntax error or access violation: 1166 ...Error
- ORA-07445 ACCESS_VIOLATION,UNABLE_TO_READ問題處理
- ORA-7445(ACCESS_VIOLATION)(unable_to_trans_pc)(UNABLE_TO_WRITE)錯誤
- 記錄:Bug 8575528 Missing entries in V$MUTEX_SLEEP.locationMutex
- Nginx 的 access log 如何以 json 形式記錄?NginxJSON
- win10系統提示access violation at address出錯的解決方法Win10
- 給Chrome“捉蟲”16000個,Google開源bug自檢工具ChromeGo
- VMware Workstation 不可恢復錯誤:(vmui) Exception 0xc0000005(access violation) has occurred.UIException
- Windows環境下的ORA-7445(ACCESS_VIOLATION)和ORA-4030錯誤Windows
- MySQL·捉蟲動態·DROPDATABASE外來鍵約束的GTIDBUGMySqlDatabaseTiDB
- Excel 2021&365 函式與公式應用大全 捉蟲Excel函式公式
- 部落格園記錄:汽車引數爬蟲爬蟲
- java爬蟲第一天-bug記錄Java爬蟲
- ChunJun 1.16 Release版本即將釋出,bug 捉蟲活動邀您參與!
- Best Practice in Writing
- Writing on important detailsImportAI
- [報錯:字元太長] SQLSTATE [42000]: Syntax error or access violation: 1071 Specified key was t oo long;字元SQLError
- Laravel5.4 資料庫遷移錯誤 SQLSTATE [42000] Syntax error or access violation 1071Laravel資料庫SQLError
- pl/sql dev連線報錯Access violation at address 67614F04 in module 'oranls11.dll'SQLdev
- Use case driven" means writing the user manual first, then writing the code
- angular學習筆記(三十一)-$location(1)Angular筆記
- angular學習筆記(三十一)-$location(2)Angular筆記
- 使用node爬蟲做了一個vue小專案記錄使用筆記爬蟲Vue筆記
- Preparation for MCM/ICM Writing
- Writing Better AdaptersAPT
- Narrative writing about a person
- Narrative writing revision