![]() |
Runtime Error c++
Hi there .this code has this error runtime :
Windows has triggered a breakpoint in a.exe. This may be due to a corruption of the heap, which indicates a bug in a.exe or any of the DLLs it has loaded. This may also be due to the user pressing F12 while a.exe has focus. [code] #include<stdio.h> #include<stdlib.h> #include<windows.h> #include<winbase.h> #include<process.h> #include<winreg.h> #include<tlhelp32.h> #include<iostream> #include<ctime> usingnamespace std; bool checkDir(LPSTR s){ FILE *fp; fp=fopen(s,"r"); /* If we can't open it as file in read mode then it can be directory */ if(fp){ fclose(fp); returnfalse; } returntrue; } void exploreDirectory(char *s) { int ln=strlen(s); strcat(s,"\\*"); WIN32_FIND_DATA FindFileData; HANDLE hFind; hFind = FindFirstFile((LPWSTR)s, &FindFileData); LPSTR str=(char *)malloc(260); strcpy(str,s); int len; do{ str[ln+1]=0; strcat(str,(constchar *)FindFileData.cFileName); if(!strcmp((constchar *)FindFileData.cFileName,".")||!strcmp((constchar *)FindFileData.cFileName,"")||!strcmp((constchar *)FindFileData.cFileName,".."))continue; if(checkDir(str)){ // we have got directory exploreDirectory(str); }else{ // we got a file..... do what you want to do cout<<str<<endl; cout<<FindFileData.cFileName<<endl; } }while(FindNextFile(hFind, &FindFileData)); FindClose(hFind); } int main() { char path[260]={"c:"}; exploreDirectory(path); } [\code] please help me:yell: |
| All times are GMT. The time now is 02:00 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.