diff --git a/src/cheat/CheatManager.cxx b/src/cheat/CheatManager.cxx index 7f17f5bda..50e30e4c6 100644 --- a/src/cheat/CheatManager.cxx +++ b/src/cheat/CheatManager.cxx @@ -230,7 +230,7 @@ void CheatManager::enable(const string& code, bool enable) void CheatManager::loadCheatDatabase() { const string& cheatfile = myOSystem.cheatFile(); - ifstream in(cheatfile.c_str()); + ifstream in(cheatfile); if(!in) return; @@ -270,7 +270,7 @@ void CheatManager::saveCheatDatabase() return; const string& cheatfile = myOSystem.cheatFile(); - ofstream out(cheatfile.c_str()); + ofstream out(cheatfile); if(!out) return; diff --git a/src/common/PNGLibrary.cxx b/src/common/PNGLibrary.cxx index 14c905279..8646ed99a 100644 --- a/src/common/PNGLibrary.cxx +++ b/src/common/PNGLibrary.cxx @@ -52,7 +52,7 @@ void PNGLibrary::loadImage(const string& filename, FBSurface& surface) int bit_depth, color_type, interlace_type; const char* err_message = nullptr; - ifstream in(filename.c_str(), ios_base::binary); + ifstream in(filename, ios_base::binary); if(!in.is_open()) loadImageERROR("No image found"); @@ -129,7 +129,7 @@ done: // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PNGLibrary::saveImage(const string& filename, const VariantList& comments) { - ofstream out(filename.c_str(), ios_base::binary); + ofstream out(filename, ios_base::binary); if(!out.is_open()) throw "ERROR: Couldn't create snapshot file"; @@ -153,7 +153,7 @@ void PNGLibrary::saveImage(const string& filename, const VariantList& comments) void PNGLibrary::saveImage(const string& filename, const FBSurface& surface, const GUI::Rect& rect, const VariantList& comments) { - ofstream out(filename.c_str(), ios_base::binary); + ofstream out(filename, ios_base::binary); if(!out.is_open()) throw "ERROR: Couldn't create snapshot file"; diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index f8c1711b3..b341e905d 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -689,7 +689,7 @@ string CartDebug::loadListFile() } FilesystemNode node(myListFile); - ifstream in(node.getPath().c_str()); + ifstream in(node.getPath()); if(!in.is_open()) return DebuggerParser::red("list file '" + node.getShortPath() + "' not readable"); @@ -753,7 +753,7 @@ string CartDebug::loadSymbolFile() } FilesystemNode node(mySymbolFile); - ifstream in(node.getPath().c_str()); + ifstream in(node.getPath()); if(!in.is_open()) return DebuggerParser::red("symbol file '" + node.getShortPath() + "' not readable"); @@ -818,7 +818,7 @@ string CartDebug::loadConfigFile() } FilesystemNode node(myCfgFile); - ifstream in(node.getPath().c_str()); + ifstream in(node.getPath()); if(!in.is_open()) return "Unable to load directives from " + node.getPath(); @@ -924,7 +924,7 @@ string CartDebug::saveConfigFile() const string& name = myConsole.properties().get(Cartridge_Name); const string& md5 = myConsole.properties().get(Cartridge_MD5); - ofstream out(node.getPath().c_str()); + ofstream out(node.getPath()); if(!out.is_open()) return "Unable to save directives to " + node.getShortPath(); @@ -964,7 +964,7 @@ string CartDebug::saveDisassembly() } FilesystemNode node(myDisasmFile); - ofstream out(node.getPath().c_str()); + ofstream out(node.getPath()); if(!out.is_open()) return "Unable to save disassembly to " + node.getShortPath(); @@ -1154,7 +1154,7 @@ string CartDebug::saveRom() myConsole.properties().get(Cartridge_Name) + ".a26"; FilesystemNode node(path); - ofstream out(node.getPath().c_str(), ios::binary); + ofstream out(node.getPath(), ios::binary); if(out.is_open() && myConsole.cartridge().save(out)) return "saved ROM as " + node.getShortPath(); else diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index e44f7d26f..3646afeab 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -128,7 +128,7 @@ string DebuggerParser::exec(const FilesystemNode& file) { if(file.exists()) { - ifstream in(file.getPath().c_str()); + ifstream in(file.getPath()); if(!in.is_open()) return red("autoexec file \'" + file.getShortPath() + "\' not found"); @@ -589,7 +589,7 @@ bool DebuggerParser::saveScriptFile(string file) file += ".stella"; } - ofstream out(file.c_str()); + ofstream out(file); FunctionDefMap funcs = debugger.getFunctionDefMap(); for(const auto& i: funcs) diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index 030cc17ad..18120d691 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -850,7 +850,7 @@ void PromptWidget::scrollToCurrent() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool PromptWidget::saveBuffer(string& filename) { - ofstream out(filename.c_str()); + ofstream out(filename); if(!out.is_open()) return false; diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 6579b4267..88ce3cab0 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -745,7 +745,7 @@ void Console::setControllers(const string& rommd5) void Console::loadUserPalette() { const string& palette = myOSystem.paletteFile(); - ifstream in(palette.c_str(), ios::binary); + ifstream in(palette, ios::binary); if(!in) return; diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 79b0dc37f..46de507d1 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -518,7 +518,7 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state) { string filename = myOSystem.baseDir() + myOSystem.console().properties().get(Cartridge_Name) + ".pro"; - ofstream out(filename.c_str()); + ofstream out(filename); if(out) { out << myOSystem.console().properties(); diff --git a/src/emucore/MT24LC256.cxx b/src/emucore/MT24LC256.cxx index 0c910eacd..00a9e1715 100644 --- a/src/emucore/MT24LC256.cxx +++ b/src/emucore/MT24LC256.cxx @@ -73,8 +73,7 @@ MT24LC256::MT24LC256(const string& filename, const System& system) jpee_ad_known(0) { // Load the data from an external file (if it exists) - ifstream in; - in.open(myDataFile.c_str(), ios_base::binary); + ifstream in(myDataFile, ios_base::binary); if(in.is_open()) { // Get length of file; it must be 32768 @@ -99,7 +98,7 @@ MT24LC256::~MT24LC256() // Save EEPROM data to external file only when necessary if(!myDataFileExists || myDataChanged) { - ofstream out(myDataFile.c_str(), ios_base::binary); + ofstream out(myDataFile, ios_base::binary); if(out.is_open()) out.write((char*)myData, 32768); } diff --git a/src/emucore/PropsSet.cxx b/src/emucore/PropsSet.cxx index 1eb66d7c5..7b2197517 100644 --- a/src/emucore/PropsSet.cxx +++ b/src/emucore/PropsSet.cxx @@ -37,7 +37,7 @@ PropertiesSet::PropertiesSet(const string& propsfile) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PropertiesSet::load(const string& filename) { - ifstream in(filename.c_str()); + ifstream in(filename); // Loop reading properties for(;;) @@ -59,7 +59,7 @@ void PropertiesSet::load(const string& filename) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool PropertiesSet::save(const string& filename) const { - ofstream out(filename.c_str()); + ofstream out(filename); if(!out) return false; diff --git a/src/emucore/Serializer.cxx b/src/emucore/Serializer.cxx index bf72996f9..eefe99bfe 100644 --- a/src/emucore/Serializer.cxx +++ b/src/emucore/Serializer.cxx @@ -32,7 +32,7 @@ Serializer::Serializer(const string& filename, bool readonly) FilesystemNode node(filename); if(node.isFile() && node.isReadable()) { - unique_ptr str = make_ptr(filename.c_str(), ios::in | ios::binary); + unique_ptr str = make_ptr(filename, ios::in | ios::binary); if(str && str->is_open()) { myStream = std::move(str); @@ -50,10 +50,10 @@ Serializer::Serializer(const string& filename, bool readonly) // So we open in write and append mode - the write creates the file // when necessary, and the append doesn't delete any data if it // already exists - fstream temp(filename.c_str(), ios::out | ios::app); + fstream temp(filename, ios::out | ios::app); temp.close(); - unique_ptr str = make_ptr(filename.c_str(), ios::in | ios::out | ios::binary); + unique_ptr str = make_ptr(filename, ios::in | ios::out | ios::binary); if(str && str->is_open()) { myStream = std::move(str); diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 838a566b8..3098607cf 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -165,7 +165,7 @@ void Settings::loadConfig() string line, key, value; string::size_type equalPos, garbage; - ifstream in(myOSystem.configFile().c_str()); + ifstream in(myOSystem.configFile()); if(!in || !in.is_open()) { myOSystem.logMessage("ERROR: Couldn't load settings file", 0); @@ -512,7 +512,7 @@ void Settings::saveConfig() if(!settingsChanged) return; - ofstream out(myOSystem.configFile().c_str()); + ofstream out(myOSystem.configFile()); if(!out || !out.is_open()) { myOSystem.logMessage("ERROR: Couldn't save settings file", 0); diff --git a/src/gui/LoggerDialog.cxx b/src/gui/LoggerDialog.cxx index a0a26c95c..cfcbf90c2 100644 --- a/src/gui/LoggerDialog.cxx +++ b/src/gui/LoggerDialog.cxx @@ -119,7 +119,7 @@ void LoggerDialog::saveLogFile() path << "~" << BSPF_PATH_SEPARATOR << "stella.log"; FilesystemNode node(path.str()); - ofstream out(node.getPath().c_str()); + ofstream out(node.getPath()); if(out.is_open()) out << instance().logMessages(); } diff --git a/src/windows/OSystemWINDOWS.cxx b/src/windows/OSystemWINDOWS.cxx index 01ea9d0bc..92aeb4ee4 100644 --- a/src/windows/OSystemWINDOWS.cxx +++ b/src/windows/OSystemWINDOWS.cxx @@ -48,7 +48,7 @@ OSystemWINDOWS::OSystemWINDOWS() FilesystemNode basedirfile("basedir.txt"); if(basedirfile.exists()) { - ifstream in(basedirfile.getPath().c_str()); + ifstream in(basedirfile.getPath()); if(in && in.is_open()) { getline(in, basedir);