dio_seek

(PHP 4 >= 4.2.0, PHP 5)

dio_seek -- Seeks to pos on fd from whence

Description

int dio_seek ( resource fd, int pos [, int whence] )

The function dio_seek() is used to change the file position of the file with descriptor fd. The parameter whence specifies how the position pos should be interpreted:

Example 1. Setting the baud rate on a serial port

<?php

$fd
= dio_open('/dev/ttyS0', O_RDWR);

dio_seek($fd, SEEK_SET, 10);
// position is now at 10 characters from the start of the file

dio_seek($fd, SEEK_CUR, -2);
// position is now at 8 characters from the start of the file

dio_seek($fd, SEEK_END, 5);
// position is now at 5 characters from the end of the file

dio_seek($fd, SEEK_END, -10);
// 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 zeros.

dio_close($fd);
?>