diff options
Diffstat (limited to 'src/posix_extras.h')
-rw-r--r-- | src/posix_extras.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/posix_extras.h b/src/posix_extras.h index a73f9fe..5571da6 100644 --- a/src/posix_extras.h +++ b/src/posix_extras.h @@ -15,8 +15,10 @@ #ifndef POSIX_EXTRAS_H_ #define POSIX_EXTRAS_H_ +#include <cstdint> #include <experimental/optional> #include <string> +#include <vector> #include <dirent.h> #include <sys/stat.h> @@ -78,6 +80,11 @@ class File { } File OpenAt(const char* path, int flags, mode_t mode) const; + // Reads exactly the specified number of bytes from the file at the given + // offset, unless doing so would run past the end of the file, in which case + // fewer bytes are returned. + std::vector<std::uint8_t> Read(off_t, size_t) const; + // Removes the file at the path relative to the file descriptor. The path // must indeed be relative (i.e., it must not start with '/'). void UnlinkAt(const char* path) const; |