184 •
Application Examples
Example of Reading and Writing from the NVRAM
WAGO-I/O-SYSTEM
750
Linux Fieldbus Coupler
•
int close(int
fd
);
This function closes the open file which is a reference to the file
descriptor.
fd:
File descriptor returned by the
open
function.
•
off_t lseek(int
fd
, off_t
offset
, int
mode
);
This function sets the position pointer to any byte within the file and
returns the current position in the file.
fd:
File descriptor returned by the
open
function.
offset:
Position within the file from which the bytes are read and written.
mode:
SEEK_SET:
Within the file, both read/write operations start from the
offset
value (in bytes).
SEEK_CUR:
Within the file, both read/write operations start from the
current po
offset
value.
SEEK_END:
Within the file, both read/write operations start from the last
byte +
offset
value (here the offset is usually "0" or negative value).