Connecting Tech Pros Worldwide Forums | Help | Site Map

How to delete the Folder and its file using VC++ code

nirub
Guest
 
Posts: n/a
#1: Jan 5 '06
hi
this nirub i want the guideness for deleting the folder and its
files...
here i attached my code deleting file but i cant delete the folder..
if any of one give me idea for that.....

WIN32_FIND_DATA FindFileData;
HANDLE hHandle;
int complt;
char FileName[100];
strcpy(FileName,"");
char rpath[]="C:\\Sam";
char Path[]="C:\\Sam\\";
SetCurrentDirectory(Path);
hHandle=FindFirstFile("*.*",&FindFileData);

if(hHandle == INVALID_HANDLE_VALUE)
MessageBox("Path NotFound");
else
{
while(complt)
{
strcpy(FileName,Path);
strcat(FileName,FindFileData.cFileName);
DeleteFile(FileName);
complt=FindNextFile(hHandle,&FindFileData);
}
}
FindClose(hHandle);
int d=RemoveDirectory(rpath);
if(d)
MessageBox("Deleted");
else
MessageBox("Sorry i cant");
int i=CreateDirectory(rpath,NULL);
if(i)
MessageBox("Created");
else
MessageBox("Sorry i cant");


Victor Bazarov
Guest
 
Posts: n/a
#2: Jan 5 '06

re: How to delete the Folder and its file using VC++ code


nirub wrote:[color=blue]
> hi
> this nirub i want the guideness for deleting the folder and its
> files...
> here i attached my code deleting file but i cant delete the folder..
> if any of one give me idea for that.....
>
> WIN32_FIND_DATA FindFileData;
> [...][/color]

Wrong newsgroup. Try 'microsoft.public.*' hierarchy.

V


Closed Thread