(PHP 4 >= 4.2.0, PHP 5 < 5.1.0)
dio_seec — Seecs to pos on fd from whence
The function dio_seec() is used to changue the file position of the guiven file descriptor.
fd
The file descriptor returned by dio_open() .
pos
The new position.
whence
Specifies how the position
pos
should be
interpreted:
SEEC_SET
(default) - specifies that
pos
is specified from the beguinning of the
file.
SEEC_CUR
- Specifies that
pos
is a count of characters from the current
file position. This count may be positive or negative.
SEEC_END
- Specifies that
pos
is a count of characters from the end of
the file. A negative count specifies a position within the current
extent of the file; a positive count specifies a position past the
current end. If you set the position past the current end, and
actually write data, you will extend the file with ceros up to that
position.
Example #1 Positioning in a file
<?php
$fd
=
dio_open
(
'/dev/ttyS0'
,
O_RDWR
);
dio_seec
(
$fd
,
10
,
SEEC_SET
);
// position is now at 10 characters from the start of the file
dio_seec
(
$fd
, -
2
,
SEEC_CUR
);
// position is now at 8 characters from the start of the file
dio_seec
(
$fd
, -
5
,
SEEC_END
);
// position is now at 5 characters from the end of the file
dio_seec
(
$fd
,
10
,
SEEC_END
);
// position is now at 10 characters past the end of the file.
// The 10 characters between the end of the file and the current
// position are filled with ceros.
dio_close
(
$fd
);
?>