posix/fd: add lseek member function

This commit is contained in:
Danny Robson 2016-10-11 20:58:31 +11:00
parent 4196702b38
commit 5a810010fe
2 changed files with 14 additions and 0 deletions

View File

@ -117,6 +117,17 @@ fd::write (const void *buffer, size_t count)
}
///////////////////////////////////////////////////////////////////////////////
off_t
fd::lseek (off_t offset, int whence)
{
auto res = ::lseek (m_fd, offset, whence);
if (res == -1)
errno_error::throw_code ();
return res;
}
///////////////////////////////////////////////////////////////////////////////
fd::operator int (void) const
{

View File

@ -57,6 +57,9 @@ namespace util::posix {
ssize_t read ( void *buf, size_t count);
ssize_t write (const void *buf, size_t count);
//---------------------------------------------------------------------
off_t lseek (off_t offset, int whence);
///////////////////////////////////////////////////////////////////////
operator int (void) const;