Creating a txt file from program

Apr 12, 2009 at 6:45pm
How I can I create a txt file from my program?
Apr 12, 2009 at 7:30pm
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 Apr 12, 2009 at 7:30pm
Apr 12, 2009 at 9:20pm
Thanks!
Topic archived. No new replies allowed.