File creating in C++
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
fstream f;
f.open("sample.txt",ios::out);
if (!f)
{
cout<<"Error in file";
return 0;
}
cout<<"File created successfully";
f.close();
}
output:
File created successfully
Comments
Post a Comment