I really need your help. It seems that I cannot do file manipulations in C ++. I used fstream to do some file manipulation, but when I compile it, an error message appears:
|63|error: no matching function for call to 'std::basic_fstream<char>::open(std::string&, const openmode&)'|
What mistake did I make?
Here is part of the source code:
#include<stdio.h>
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
inline int exports()
{
string fdir;
cout << "File to export (include the directory of the file): ";
cin >> fdir;
fstream fp;
fp.open(fdir, ios::app);
if (!fp.is_open())
cerr << "File not found. Check the file a file manager if it exists.";
else
{
string creator, map_name, date;
cout << "Creator name: ";
cin >> creator;
cout << "\nMap name: ";
cin >> map_name;
cout << "\nDate map Created: ";
cin >> date;
fp << "<tresmarck valid='true' creator='"+ creator +"' map='"+ map_name +"' date='"+ date +"'></tresmarck>" << endl;
fp.close();
cout << "\nCongratulations! You just made your map. Now send it over to tresmarck@gmail.com for proper signing. We will also ask you questions. Thank you.";
}
return 0;
}
source
share