diff --git a/Applications/DataExplorer/DataView/SaveMeshDialog.cpp b/Applications/DataExplorer/DataView/SaveMeshDialog.cpp
index a46c5c6e88f571b85cf2e66597dfad81dc6c19b1..ecb3acc8d4b19ae81b80e20ba0cc59322efe4c2c 100644
--- a/Applications/DataExplorer/DataView/SaveMeshDialog.cpp
+++ b/Applications/DataExplorer/DataView/SaveMeshDialog.cpp
@@ -87,7 +87,8 @@ void SaveMeshDialog::accept()
     {
         MeshLib::IO::Legacy::MeshIO meshIO;
         meshIO.setMesh(&_mesh);
-        meshIO.writeToFile(file_name.toStdString());
+        BaseLib::IO::writeStringToFile(meshIO.writeToString(),
+                                       file_name.toStdString());
     }
     LastSavedFileDirectory::setDir(file_name);
 
diff --git a/Applications/DataExplorer/mainwindow.cpp b/Applications/DataExplorer/mainwindow.cpp
index 3162fc3dc770e0f5fc810550888f25203ffebc0c..da7f10411de85567216ae437054242ccad27e076 100644
--- a/Applications/DataExplorer/mainwindow.cpp
+++ b/Applications/DataExplorer/mainwindow.cpp
@@ -478,7 +478,8 @@ void MainWindow::save()
     if (fi.suffix().toLower() == "prj")
     {
         XmlPrjInterface xml(_project);
-        xml.writeToFile(fileName.toStdString());
+        BaseLib::IO::writeStringToFile(xml.writeToString(),
+                                       fileName.toStdString());
     }
     else if (fi.suffix().toLower() == "geo")
     {
@@ -495,7 +496,8 @@ void MainWindow::save()
             FileIO::GMSH::MeshDensityAlgorithm::FixedMeshDensity, point_density,
             station_density, max_pnts_per_leaf, selected_geometries, false,
             false);
-        bool const success = gmsh_io.writeToFile(fileName.toStdString());
+        bool const success = BaseLib::IO::writeStringToFile(
+            gmsh_io.writeToString(), fileName.toStdString());
 
         if (!success)
         {
@@ -917,14 +919,14 @@ void MainWindow::writeGeometryToFile(QString gliName, QString fileName)
 #endif
     GeoLib::IO::XmlGmlInterface xml(_project.getGEOObjects());
     xml.export_name = gliName.toStdString();
-    xml.writeToFile(fileName.toStdString());
+    BaseLib::IO::writeStringToFile(xml.writeToString(), fileName.toStdString());
 }
 
 void MainWindow::writeStationListToFile(QString listName, QString fileName)
 {
     GeoLib::IO::XmlStnInterface xml(_project.getGEOObjects());
     xml.export_name = listName.toStdString();
-    xml.writeToFile(fileName.toStdString());
+    BaseLib::IO::writeStringToFile(xml.writeToString(), fileName.toStdString());
 }
 
 void MainWindow::mapGeometry(const std::string &geo_name)
@@ -1061,13 +1063,15 @@ void MainWindow::callGMSH(std::vector<std::string> & selectedGeometries,
                     _project.getGEOObjects(), true,
                     FileIO::GMSH::MeshDensityAlgorithm::AdaptiveMeshDensity,
                     param2, param3, param1, selectedGeometries, false, false);
-                gmsh_io.writeToFile(fileName.toStdString());
+                BaseLib::IO::writeStringToFile(gmsh_io.writeToString(),
+                                               fileName.toStdString());
             } else { // homogeneous meshing selected
                 FileIO::GMSH::GMSHInterface gmsh_io(
                     _project.getGEOObjects(), true,
                     FileIO::GMSH::MeshDensityAlgorithm::FixedMeshDensity,
                     param4, param3, param1, selectedGeometries, false, false);
-                gmsh_io.writeToFile(fileName.toStdString());
+                BaseLib::IO::writeStringToFile(gmsh_io.writeToString(),
+                                               fileName.toStdString());
             }
 
             if (system(nullptr) != 0)  // command processor available
diff --git a/Applications/FileIO/Legacy/createSurface.cpp b/Applications/FileIO/Legacy/createSurface.cpp
index ffc73e69482c105b1a2a66c128a8b00efd8bd916..72cb2f6bf63d6f261b8868b04dad2d2df4c2f536 100644
--- a/Applications/FileIO/Legacy/createSurface.cpp
+++ b/Applications/FileIO/Legacy/createSurface.cpp
@@ -81,7 +81,7 @@ bool createSurface(GeoLib::Polyline const& ply,
     auto geo_file = fs::temp_directory_path() /= BaseLib::randomString(32);
     auto msh_file = fs::temp_directory_path() /= BaseLib::randomString(32);
 
-    gmsh_io.writeToFile(geo_file);
+    BaseLib::IO::writeStringToFile(gmsh_io.writeToString(), geo_file);
     // Using GMSH's vtk output here so we don't have to deal with GMSH and it's
     // various file format versions here
     std::string gmsh_command =
diff --git a/Applications/FileIO/SWMM/SWMMInterface.cpp b/Applications/FileIO/SWMM/SWMMInterface.cpp
index 094ae5f11400cd10fbeb4a4738cb4cb469e8d8ed..43029fc13233aec33dd5558ce77f2cfdca75a188 100644
--- a/Applications/FileIO/SWMM/SWMMInterface.cpp
+++ b/Applications/FileIO/SWMM/SWMMInterface.cpp
@@ -1321,7 +1321,7 @@ bool SwmmInterface::writeCsvForTimestep(std::string const& file_name, SwmmObject
         ERR ("No data to write");
         return false;
     }
-    csv.writeToFile(file_name);
+    BaseLib::IO::writeStringToFile(csv.writeToString(), file_name);
     return true;
 }
 
@@ -1343,7 +1343,7 @@ bool SwmmInterface::writeCsvForObject(std::string const& file_name, SwmmObject o
         ERR ("No data to write");
         return false;
     }
-    csv.writeToFile(file_name);
+    BaseLib::IO::writeStringToFile(csv.writeToString(), file_name);
     return true;
 }
 
diff --git a/Applications/FileIO/XmlIO/Qt/XmlPrjInterface.cpp b/Applications/FileIO/XmlIO/Qt/XmlPrjInterface.cpp
index 88b82638c4327d666d9a48c520f6672c08bb4bbc..20452c12552de6ca9818a6427d39d83b08344885 100644
--- a/Applications/FileIO/XmlIO/Qt/XmlPrjInterface.cpp
+++ b/Applications/FileIO/XmlIO/Qt/XmlPrjInterface.cpp
@@ -334,7 +334,7 @@ T* XmlPrjInterface::parseCondition(
 int XmlPrjInterface::writeToFile(const std::string& filename)
 {
     _filename = filename;
-    return BaseLib::IO::Writer::writeToFile(filename);
+    return BaseLib::IO::writeStringToFile(writeToString(), filename);
 }
 
 bool XmlPrjInterface::write()
@@ -376,7 +376,8 @@ bool XmlPrjInterface::write()
         // write gml file
         GeoLib::IO::XmlGmlInterface gml(geo_objects);
         gml.export_name = name;
-        if (gml.writeToFile(std::string(path + name + ".gml")))
+        if (BaseLib::IO::writeStringToFile(gml.writeToString(),
+                                           std::string(path + name + ".gml")))
         {
             // write entry in project file
             QDomElement geo_tag = doc.createElement("geometry");
@@ -399,7 +400,8 @@ bool XmlPrjInterface::write()
         GeoLib::IO::XmlStnInterface stn(geo_objects);
         stn.export_name = name;
 
-        if (stn.writeToFile(path + name + ".stn"))
+        if (BaseLib::IO::writeStringToFile(stn.writeToString(),
+                                           path + name + ".stn"))
         {
             // write entry in project file
             QDomElement stn_tag = doc.createElement("stations");
diff --git a/Applications/FileIO/writeGeometryToFile.cpp b/Applications/FileIO/writeGeometryToFile.cpp
index a83a9a7ee4836c8c444e0b216f4903b5bd3d6a07..23e8f25bc556399e648daa49ebee37a28826fff1 100644
--- a/Applications/FileIO/writeGeometryToFile.cpp
+++ b/Applications/FileIO/writeGeometryToFile.cpp
@@ -26,7 +26,7 @@ void writeGeometryToFile(std::string const& geo_name,
     if (extension == ".gml" || extension == ".GML") {
         GeoLib::IO::BoostXmlGmlInterface xml(geo_objs);
         xml.export_name = geo_name;
-        xml.writeToFile(fname);
+        BaseLib::IO::writeStringToFile(xml.writeToString(), fname);
     } else if (extension == "gli" || extension == "GLI") {
         FileIO::Legacy::writeGLIFileV4(fname, geo_name, geo_objs);
     } else {
diff --git a/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp b/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp
index 48f86b33385f64b7c41b64a248b6ce1ee8093fec..48c7362a712d7ba9b12e20a29cd2e2837b1051fe 100644
--- a/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp
+++ b/Applications/Utils/FileConverter/ConvertSHPToGLI.cpp
@@ -93,11 +93,11 @@ void convertPoints (DBFHandle dbf_handle,
     if (station) {
         GeoLib::IO::XmlStnInterface xml (geo_objs);
         xml.export_name = points_group_name;
-        xml.writeToFile(out_fname);
+        BaseLib::IO::writeStringToFile(xml.writeToString(), out_fname);
     } else {
         GeoLib::IO::XmlGmlInterface xml (geo_objs);
         xml.export_name = points_group_name;
-        xml.writeToFile(out_fname);
+        BaseLib::IO::writeStringToFile(xml.writeToString(), out_fname);
     }
 }
 
diff --git a/Applications/Utils/FileConverter/VTK2OGS.cpp b/Applications/Utils/FileConverter/VTK2OGS.cpp
index e671dfab7588766ced3e4b9ac63888cb5d23cb7d..1d1f767f931c86c02390f80e95d1b7afa19e6258 100644
--- a/Applications/Utils/FileConverter/VTK2OGS.cpp
+++ b/Applications/Utils/FileConverter/VTK2OGS.cpp
@@ -47,7 +47,7 @@ int main (int argc, char* argv[])
 
     MeshLib::IO::Legacy::MeshIO meshIO;
     meshIO.setMesh(mesh);
-    meshIO.writeToFile(mesh_out.getValue());
+    BaseLib::IO::writeStringToFile(meshIO.writeToString(), mesh_out.getValue());
 
     return EXIT_SUCCESS;
 }
diff --git a/Applications/Utils/GeoTools/MoveGeometry.cpp b/Applications/Utils/GeoTools/MoveGeometry.cpp
index 9625e6ad00cc95751df84e8316729aefd1eb677a..87c60334622be7e90ce0ce56ad262529df99c24f 100644
--- a/Applications/Utils/GeoTools/MoveGeometry.cpp
+++ b/Applications/Utils/GeoTools/MoveGeometry.cpp
@@ -93,7 +93,8 @@ int main(int argc, char *argv[])
     }
 
     xml.export_name = geo_name;
-    xml.writeToFile(geo_output_arg.getValue());
+    BaseLib::IO::writeStringToFile(xml.writeToString(),
+                                   geo_output_arg.getValue());
 
     return EXIT_SUCCESS;
 }
diff --git a/Applications/Utils/GeoTools/TriangulatePolyline.cpp b/Applications/Utils/GeoTools/TriangulatePolyline.cpp
index fc60270562521d2dc1fcb71e6d4e1991cd3f8824..8eeb8170aba3d8e08408c23da85d93ca904213d1 100644
--- a/Applications/Utils/GeoTools/TriangulatePolyline.cpp
+++ b/Applications/Utils/GeoTools/TriangulatePolyline.cpp
@@ -145,7 +145,7 @@ int main(int argc, char *argv[])
 
     // write new file
     xml.export_name = geo_name;
-    xml.writeToFile(output_arg.getValue());
+    BaseLib::IO::writeStringToFile(xml.writeToString(), output_arg.getValue());
     INFO ("...done.");
 
     return EXIT_SUCCESS;
diff --git a/Applications/Utils/MeshEdit/MapGeometryToMeshSurface.cpp b/Applications/Utils/MeshEdit/MapGeometryToMeshSurface.cpp
index 66716e73318c1517b261ae785a891192ba89c4a5..0047666847f4bb67228368a16f051d72a3a9814a 100644
--- a/Applications/Utils/MeshEdit/MapGeometryToMeshSurface.cpp
+++ b/Applications/Utils/MeshEdit/MapGeometryToMeshSurface.cpp
@@ -82,7 +82,8 @@ int main (int argc, char* argv[])
     {
         GeoLib::IO::BoostXmlGmlInterface xml_io(geometries);
         xml_io.export_name = geo_name;
-        xml_io.writeToFile(output_geometry_fname.getValue());
+        BaseLib::IO::writeStringToFile(xml_io.writeToString(),
+                                       output_geometry_fname.getValue());
     }
     return EXIT_SUCCESS;
 }
diff --git a/Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp b/Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp
index a439d3f308c4698144b6e09cec3a80214ec5d806..22db8db946c256abab8c308a70ca424d2cbea950 100644
--- a/Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp
+++ b/Applications/Utils/MeshGeoTools/VerticalSliceFromLayers.cpp
@@ -198,7 +198,7 @@ void consolidateGeometry(GeoLib::GEOObjects& geo,
     std::string const filename(output_name + ".gml");
     GeoLib::IO::XmlGmlInterface xml(geo);
     xml.export_name = merged_geo_name;
-    xml.writeToFile(filename);
+    BaseLib::IO::writeStringToFile(xml.writeToString(), filename);
 
     geo.removePolylineVec(merged_geo_name);
     geo.removePointVec(merged_geo_name);
@@ -224,7 +224,8 @@ MeshLib::Mesh* generateMesh(GeoLib::GEOObjects& geo,
         geo, true, FileIO::GMSH::MeshDensityAlgorithm::FixedMeshDensity, res, 0,
         0, gmsh_geo, false, false);
     gmsh_io.writePhysicalGroups(true);
-    bool const success = gmsh_io.writeToFile(gmsh_geo_name);
+    bool const success =
+        BaseLib::IO::writeStringToFile(gmsh_io.writeToString(), gmsh_geo_name);
 
     std::string const gmsh_mesh_name = output_name + ".msh";
     std::string gmsh_command = "gmsh -2 -algo meshadapt " + gmsh_geo_name;
diff --git a/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp b/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp
index 8119ad349fbb87bee51d37e6893e26254e8fcc3c..f40de784429bf9bc4e41d52db608b1ba7e8ddd94 100644
--- a/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp
+++ b/Applications/Utils/OGSFileConverter/OGSFileConverter.cpp
@@ -114,7 +114,7 @@ void OGSFileConverter::convertGLI2GML(const QStringList &input, const QString &o
             std::string const geo_name =
                 BaseLib::extractBaseName(input_string.toStdString());
             xml.export_name = geo_name;
-            xml.writeToFile(output_str);
+            BaseLib::IO::writeStringToFile(xml.writeToString(), output_str);
             geo_objects.removeSurfaceVec(geo_name);
             geo_objects.removePolylineVec(geo_name);
             geo_objects.removePointVec(geo_name);
@@ -156,7 +156,7 @@ void OGSFileConverter::convertVTU2MSH(const QStringList &input, const QString &o
         }
         MeshLib::IO::Legacy::MeshIO meshIO;
         meshIO.setMesh(mesh);
-        meshIO.writeToFile(output_str);
+        BaseLib::IO::writeStringToFile(meshIO.writeToString(), output_str);
         delete mesh;
     }
     OGSError::box("File conversion finished");
diff --git a/Applications/Utils/SWMMConverter/SWMMConverter.cpp b/Applications/Utils/SWMMConverter/SWMMConverter.cpp
index 09eb89bbf82f2a751207f6f88821a0135ef03072..1fa4fd9781ae57390459240b27c2af7fb7afccd1 100644
--- a/Applications/Utils/SWMMConverter/SWMMConverter.cpp
+++ b/Applications/Utils/SWMMConverter/SWMMConverter.cpp
@@ -32,7 +32,7 @@ int writeGeoOutput(std::string input_file, std::string output_file)
 
     GeoLib::IO::BoostXmlGmlInterface xml(geo_objects);
     xml.export_name = BaseLib::extractBaseNameWithoutExtension(input_file);
-    xml.writeToFile(output_file);
+    BaseLib::IO::writeStringToFile(xml.writeToString(), output_file);
     return 0;
 }
 
diff --git a/BaseLib/IO/Writer.cpp b/BaseLib/IO/Writer.cpp
index 350d98d448b61a6dcf587175ebab0ae268e12c12..be8c08e720e888ddfb3fccdb598c3098835077dd 100644
--- a/BaseLib/IO/Writer.cpp
+++ b/BaseLib/IO/Writer.cpp
@@ -43,11 +43,6 @@ std::string Writer::writeToString()
     return std::string("");
 }
 
-int Writer::writeToFile(std::filesystem::path const& file_path)
-{
-    return writeStringToFile(writeToString(), file_path);
-}
-
 int writeStringToFile(std::string content,
                       std::filesystem::path const& file_path)
 {
diff --git a/BaseLib/IO/Writer.h b/BaseLib/IO/Writer.h
index a7bbd691fb3d32dc701bbd95eeba64e3532ba0d1..1c682d9ac72adc797a4a99a0603b28a47b38d013 100644
--- a/BaseLib/IO/Writer.h
+++ b/BaseLib/IO/Writer.h
@@ -36,9 +36,6 @@ public:
     /// @brief Writes the object to a string.
     std::string writeToString();
 
-    /// @brief Writes the object to the given file.
-    int writeToFile(std::filesystem::path const& file_path);
-
 protected:
     /// @brief Writes the object to the internal stream.
     /// This method must be implemented by a subclass.
diff --git a/MeshLib/IO/writeMeshToFile.cpp b/MeshLib/IO/writeMeshToFile.cpp
index 377aa6f79b0c7a1c54b9a49aeb15fb95204785ad..1adb694ad0d2418fc0d3bdc795d171fe041c3cec 100644
--- a/MeshLib/IO/writeMeshToFile.cpp
+++ b/MeshLib/IO/writeMeshToFile.cpp
@@ -26,7 +26,7 @@ int writeMeshToFile(const MeshLib::Mesh& mesh,
     {
         MeshLib::IO::Legacy::MeshIO meshIO;
         meshIO.setMesh(&mesh);
-        meshIO.writeToFile(file_path);
+        BaseLib::IO::writeStringToFile(meshIO.writeToString(), file_path);
         return 0;
     }
     if (file_path.extension().string() == ".vtu")
diff --git a/Tests/FileIO/TestBoostGmlInterface.cpp b/Tests/FileIO/TestBoostGmlInterface.cpp
index bfe7aa59641d68604a840d601aa7c955a1496be5..94e9591c016900359d79d0ef006aee2cf94e8b96 100644
--- a/Tests/FileIO/TestBoostGmlInterface.cpp
+++ b/Tests/FileIO/TestBoostGmlInterface.cpp
@@ -30,7 +30,8 @@ TEST_F(TestGmlInterface, BoostXmlGmlWriterReaderTest)
 
     GeoLib::IO::BoostXmlGmlInterface xml(geo_objects);
     xml.export_name = geo_name;
-    int result = xml.writeToFile(test_data_file);
+    int result =
+        BaseLib::IO::writeStringToFile(xml.writeToString(), test_data_file);
     EXPECT_EQ(result, 1);
 
     // remove the written data from the data structures
diff --git a/Tests/FileIO/TestCsvWriter.cpp b/Tests/FileIO/TestCsvWriter.cpp
index 9cacb6717f919e34448d1930c28b19309328d4dd..b37d9ed9fa440aabd0fa09bb2201e9762024769a 100644
--- a/Tests/FileIO/TestCsvWriter.cpp
+++ b/Tests/FileIO/TestCsvWriter.cpp
@@ -48,7 +48,7 @@ TEST(CsvWriter, WriteReadTest)
     ASSERT_EQ(3, csv.getNArrays());
     csv.addIndexVectorForWriting(str_vec.size());
     ASSERT_EQ(4, csv.getNArrays());
-    int result = csv.writeToFile(test_file);
+    int result = BaseLib::IO::writeStringToFile(csv.writeToString(), test_file);
     ASSERT_EQ(1, result);
 
     std::vector<std::string> str_result;
diff --git a/Tests/FileIO_Qt/TestQtGmlInterface.cpp b/Tests/FileIO_Qt/TestQtGmlInterface.cpp
index 6eaedba8178b68ed2ce95638b57fcabf3b37343c..e45f337faf8a6ff354379d18ffd81815d752f603 100644
--- a/Tests/FileIO_Qt/TestQtGmlInterface.cpp
+++ b/Tests/FileIO_Qt/TestQtGmlInterface.cpp
@@ -30,7 +30,8 @@ TEST_F(TestGmlInterface, QtXmlGmlWriterReaderTest)
 
     GeoLib::IO::XmlGmlInterface xml(geo_objects);
     xml.export_name = geo_name;
-    int result = xml.writeToFile(test_data_file);
+    int result =
+        BaseLib::IO::writeStringToFile(xml.writeToString(), test_data_file);
     EXPECT_EQ(result, 1);
 
     // remove the written data from the data structures