• Welcome to ForumKorner!
    Join today and become a part of the community.

[C++] Delete a file

flAmingw0rm

Member
Reputation
0
Code:
// Snippet to delete files
//Written by nirvanarupali


#include <iostream>

using namespace std;


int main ()
{


    if( remove( "C:\\File.txt" ) == -1 ) // You can change this to a directory
                                                      // of your file.
        cout <<"Error deleting file";
    
        else
    
        cout <<"File successfully deleted";
    

   return 0;

}

Change the directory where your file is located.
 
Reputation
0
Cool , i can use this in my C++ program thanks for sharing this.
 
Top