Added writeFile() convenience function.
This commit is contained in:
parent
8a7604fb58
commit
358adfce04
@ -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);
|
||||
|
||||
} // namespace Exiv2
|
||||
|
||||
#endif // #ifndef BASICIO_HPP_
|
||||
|
||||
Loading…
Reference in New Issue
Block a user