I'm a c++ newbie here, trying out some stuff and when I try to compile
this:
void create() {
char name;
cout << "Creating a new timetable /n Please type a name for this
timetable";
cin >name;
ofstream editFile;
editFile.open (name, ios::out | ios::app);
editFile << name << endl;
}
I get this:
invalid conversion from `char' to `const char*'
I kinda understand why i'm getting this since when I change:
editFile.open (name, ios::out | ios::app);
To:
editFile.open ("Timetable.txt ", ios::out | ios::app); , it compiles
But how do I get it do do what I want?
this:
void create() {
char name;
cout << "Creating a new timetable /n Please type a name for this
timetable";
cin >name;
ofstream editFile;
editFile.open (name, ios::out | ios::app);
editFile << name << endl;
}
I get this:
invalid conversion from `char' to `const char*'
I kinda understand why i'm getting this since when I change:
editFile.open (name, ios::out | ios::app);
To:
editFile.open ("Timetable.txt ", ios::out | ios::app); , it compiles
But how do I get it do do what I want?
Comment