Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Software (http://www.velocityreviews.com/forums/f6-software.html)
-   -   Runtime Error c++ (http://www.velocityreviews.com/forums/t948908-runtime-error-c.html)

AMYS 08-01-2012 08:37 AM

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.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57