The Folder deletion method I used in the program does not help you
Bool deletedirectory (ansistring dirname)
{
// This function deletes a non-empty directory dirname
Shfileopstruct filestruct;
Memset (& filestruct, 0, sizeof (filestruct); // fill the structure buffer with 0
Filestruct. hwnd = NULL;
Filestruct. wfunc = fo_delete; // Delete
Filestruct. pfrom = dirname. c_str ();
Filestruct. PTO = NULL;
Filestruct. fflags = fof_noconfirmation + fof_silent;
Filestruct. hnamemappings = NULL;
If (shfileoperation (& filestruct) = 0)
Return true;
Else
Return false;
}
// In addition, one of the methods I get from others is as follows:
Bool _ stdcall deldir (char * dir_fullpath) // Delete the specified directory
{
Char dir [260];
Char filename [260];
Int Len = 0;
Int CH = '//';
Strcpy (Dir, dir_fullpath );
Len = strlen (DIR );
Char * temp = strrchr (Dir, CH );
If (LEN <4 | temp = NULL) // it may be the disk root directory or an invalid directory path.
Return false;
If (temp! = NULL)
{
If (temp-Dir + 1 )! = Len) // Add '/' After the Directory '/'
Strcat (Dir ,"//");
}
Getcurrentdirectory (260, filename );
Strcat (filename ,"//");
If (strcmp (Dir, filename) = 0) // If the directory to be deleted is the current directory
{
Strcat (filename ,"..");
Setcurrentdirectory (filename); // change the current directory
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service