summaryrefslogtreecommitdiff
path: root/src/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.cc')
-rw-r--r--src/util.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc
index f5a15944..a920ce0e 100644
--- a/src/util.cc
+++ b/src/util.cc
@@ -272,6 +272,15 @@ dcp::file_to_string (boost::filesystem::path p, uintmax_t max_length)
}
+void
+dcp::write_string_to_file(string const& string, boost::filesystem::path const& path)
+{
+ File file(path, "w");
+ if (!file) {
+ throw FileError("could not open file", path, errno);
+ }
+
+ file.write(string.c_str(), string.length(), 1);
}