Program to create a text file by using object belonging to fstream for reading/writing mode.

  • Post author:
  • Post category:c++
  • Post comments:0 Comments

#include
#include
#include
#include
#include
main()
{
ofstream vasu;
char fn[15],ch;
clrscr();
cout<>fn;
vasu.open(fn);
if(vasu.fail())
{
cout<<"n File Can't Be Opened … Try Again…..";
getch();
exit(1);
}
else
{
vasu<<"n Today we are meeting for ugca1909";
vasu<<"n All class members are participating in it.";
vasu<<"n I am sharing my screen during this class.";
}
vasu.close();
getch();
}

Leave a Reply