Ho davvero bisogno del tuo aiuto. Sembra che non riesca a manipolare i file in C++. Ho usato fstream fare qualche manipolazione di file, ma quando compilo esso, viene visualizzato un errore che dico:Errore fstream in C++
|63|error: no matching function for call to 'std::basic_fstream<char>::open(std::string&, const openmode&)'|
Qual è l'errore che ho fatto?
Ecco parte del codice sorgente:
#include<stdio.h>
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
inline int exports()
{
string fdir;
// Export Tiled Map
cout << "File to export (include the directory of the file): ";
cin >> fdir;
fstream fp; // File for the map
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's 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 [email protected] for proper signing. We will also ask you questions. Thank you.";
}
return 0;
}
Grazie mille hmjd! Questo ha funzionato. Immagino di non averlo compilato in C++ 11. –