I'm trying to write a C++ program that alters a .txt file. However when I run it I get a strange error.
The error:
6:20 C:\Dev-Cpp\Homework6.cpp incomplete universal character name \U
My code:
#include <iostream>
#include <fstream>
using namespace std;
int main () {
ofstream myfile ("C:\Users\My Name\Desktop\test\input.txt");
if (myfile.is_open())
{
myfile << "This is a line.\n";
myfile << "This is another line.\n";
myfile.close();
}
else cout << "Unable to open file";
return 0;
}
What am I doing wrong?