Document number
204911
Version
Rev. K
Issue date
2016-10-11
Sirius Breadboard User Manual
www.aacmicrotec.com
Page
43
of
106
Return value
Description
0
Device closed successfully
-1
see
errno
values
errno values
EBADF
The file descriptor
fd
is not an
open file descriptor
5.7.2.3.
size_t lseek(…)
Sets page offset for read/ write operations.
Argument name
Type
Direction Description
fd
int
in
File descriptor received at
open
.
offset
off_t
in
Page number.
whence
int
in
Must be set to SEEK_SET.
Return value
Description
offset
Page number
- 1
see
errno
values
errno values
EBADF
The file descriptor
fd
is not an
open file descriptor
EINVAL
The whence argument is not a
proper value, or the resulting file
offset would be negative for a
regular file, block special file, or
directory.
EOVERFLOW
The resulting file offset would be a
value which cannot be
represented correctly in an object
of type
off_t
.
5.7.2.4.
size_t read(…)
Reads requested size of bytes from the device starting from the offset set in
lseek
.
Note!
For iterative read operations,
lseek
must be called to set page offset
before
each
read operation.
Argument name
Type
Direction Description
fd
int
in
File descriptor received at
open
.
buf
void *
in
Character buffer where to store the data
nbytes
size_t
in
Number of bytes to read into
buf
.