diff Core/Toolbox.cpp @ 1588:b5bc87a7212d

OrthancPluginReadFile, OrthancPluginWriteFile
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 26 Aug 2015 16:49:46 +0200
parents bd1889029cbb
children 334d3a92ed83
line wrap: on
line diff
--- a/Core/Toolbox.cpp	Wed Aug 26 12:12:25 2015 +0200
+++ b/Core/Toolbox.cpp	Wed Aug 26 16:49:46 2015 +0200
@@ -230,7 +230,8 @@
   }
 
 
-  void Toolbox::WriteFile(const std::string& content,
+  void Toolbox::WriteFile(const void* content,
+                          size_t size,
                           const std::string& path)
   {
     boost::filesystem::ofstream f;
@@ -240,15 +241,22 @@
       throw OrthancException(ErrorCode_CannotWriteFile);
     }
 
-    if (content.size() != 0)
+    if (size != 0)
     {
-      f.write(content.c_str(), content.size());
+      f.write(reinterpret_cast<const char*>(content), size);
     }
 
     f.close();
   }
 
 
+  void Toolbox::WriteFile(const std::string& content,
+                          const std::string& path)
+  {
+    WriteFile(content.size() > 0 ? content.c_str() : NULL,
+              content.size(), path);
+  }
+
 
   void Toolbox::RemoveFile(const std::string& path)
   {