creating a "note pad" document at run time

Aug 14, 2011 at 6:02pm
Is there a c++ library that can be used to create a "notepad" document at run time? I've notice that this was possible for bitmaps when I looked at my lecture's code which did something similar.

Aug 14, 2011 at 6:13pm
It's not clear exactly what you want...

Are you trying to make a new text file? Spawn an instance of notepad.exe?
Aug 14, 2011 at 6:48pm
I think you are talking about fstream
In fstream you can create anything to hold variables
Like so
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <fstream>
using namespace std;
int main ()
{
	ofstream MyFile;
	MyFile.open ("HelloWorld.txt"); //Creates a text document called HelloWorld.txt
	MyFile << "Hello World I am a text document :)" << endl; //Writes in HelloWorld.txt
	MyFile.close ();	//Closes the document
	cout << "Press ENTER to end the program." << endl;
	cin.get ();
	return 0;
}

Note :
Every time you run the program it overwrites the previous file called HelloWorld.txt
For more information go to http://www.cplusplus.com/doc/tutorial/files/
Last edited on Aug 14, 2011 at 7:13pm
Aug 17, 2011 at 10:31pm
thanks
Topic archived. No new replies allowed.