#include <iostream>
#include <fstream>
#include <cwchar>
usingnamespace std;
int main ()
{
ofstream MyFile;
wchar_t * cptrDocname = newwchar_t L"HelloWorld.txt";
//MyFile.open ("HelloWorld.txt"); //Creates a text document called HelloWorld.txt
MyFile.open (cptrDocname); //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
delete cptrDocname;
cout << "Press ENTER to end the program." << endl;
cin.get ();
return 0;
}
error message:
1>c:\users\home\documents\visual studio 2008\projects\dynamic naming\dynamic naming\main.cpp(8) : error C2143: syntax error : missing ';' before 'string'