@ -614,4 +614,13 @@ namespace Exiv2 {
return buf;
}
long writeFile(const DataBuf& buf, const std::string& path)
{
FileIo file(path);
if (file.open("wb") != 0) {
throw Error(10, path, "wb", strError());
return file.write(buf.pData_, buf.size_);
} // namespace Exiv2
@ -683,6 +683,9 @@ namespace Exiv2 {
//! Read file \em path into a DataBuf, which is returned.
DataBuf readFile(const std::string& path);
//! Write DataBuf \em buf to file \em path. Return the number of bytes written.
long writeFile(const DataBuf& buf, const std::string& path);
#endif // #ifndef BASICIO_HPP_