I am trying to substitute a variable for the file directory.
Here is the error:
error: no matching function for call to 'std::basic_ofstream<char>::basic_ofstream(std::string&)'
#include <iostream>
#include <fstream>
#include <string>
#include <cstdlib>
#include <stdio.h>
#include <windows.h>
using namespace std;
class Createc{
public:
string file;
void Createm()
{
file = ("thefile.txt");
ofstream thefile (file);
thefile << "hi" << endl;
thefile.close();
}
};
int main()
{
Createc create;
create.Createm();
}
Please tell me what I am doing wrong
That Works!!
Thank you very much!!