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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • nirub

    #1

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

    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\\" ;
    SetCurrentDirec tory(Path);
    hHandle=FindFir stFile("*.*",&F indFileData);

    if(hHandle == INVALID_HANDLE_ VALUE)
    MessageBox("Pat h NotFound");
    else
    {
    while(complt)
    {
    strcpy(FileName ,Path);
    strcat(FileName ,FindFileData.c FileName);
    DeleteFile(File Name);
    complt=FindNext File(hHandle,&F indFileData);
    }
    }
    FindClose(hHand le);
    int d=RemoveDirecto ry(rpath);
    if(d)
    MessageBox("Del eted");
    else
    MessageBox("Sor ry i cant");
    int i=CreateDirecto ry(rpath,NULL);
    if(i)
    MessageBox("Cre ated");
    else
    MessageBox("Sor ry i cant");

  • Victor Bazarov

    #2
    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.publ ic.*' hierarchy.

    V


    Comment

    Working...