File Write
#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
/* ofstream class is used to write on files */
ofstream newFile;
newFile.open("sample.txt");
newFile << "HELLO WORLD..!!";
newFile.close();
cout<< "Written to the file sample";
return 0;
}
Output:
Written to the file sample