Thread: std::remove("File1.txt");

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    385

    std::remove("File1.txt");

    I am trying to remove a file named File1 like this but this doesn´t remove(delete) this file.
    I beleive it is the correct syntax to delete a file.


    Code:
    #include "stdafx.h"
    #include <iostream>
    #include <fstream>
    #include <sstream> 
    #include <string>  
    
    
    using namespace std;
    
    int main()
    {
       ifstream input  ("File1.txt");
       ofstream output ("File2.txt");
       
          {
             output << "Text" << "\n";
          }
    	  std::remove("File1.txt");
    
       return 0;
    }
    Last edited by Coding; 02-19-2008 at 04:27 PM.

Popular pages Recent additions subscribe to a feed