C++ program to write text in a FILE

//to write text "File handling in C++ is easy" in a file named MyFile.txt

#include <iostream>
#include <fstream>
using namespace std;
int main()
{
    ofstream out("MyFile.txt");
    out<<"File handling in C++ is easy";
    out.close();
    cout<<"File has been created successfully...see in drive";
    return 0;
}

No comments:

Post a Comment