Creating a txt file from program

How I can I create a txt file from my program?
1
2
3
4
5
6
7
8
9
10
11
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
   ofstream a_file ( "example.txt");//creates the file example.txt
   //use a_file << blah blah blah to write to it
   // use a_file >> blah blah blah to read from it
   system("pause");
   return 0;  
}
Last edited on
Thanks!
Topic archived. No new replies allowed.