array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'zh', ), 'this' => array ( 0 => 'function.dio-seek.php', 1 => 'dio_seek', ), 'up' => array ( 0 => 'ref.dio.php', 1 => 'Direct IO 函数', ), 'prev' => array ( 0 => 'function.dio-read.php', 1 => 'dio_read', ), 'next' => array ( 0 => 'function.dio-stat.php', 1 => 'dio_stat', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'zh', 'path' => 'reference/dio/functions/dio-seek.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 4 >= 4.2.0, PHP 5 < 5.1.0)
dio_seek — 在 fd 指定 pos 位置
函数 dio_seek() 用于更改给定文件描述符的文件当前读/写位置。
示例 #1 在文件中定位
<?php
$fd = dio_open('/dev/ttyS0', O_RDWR);
dio_seek($fd, 10, SEEK_SET);
// position is now at 10 characters from the start of the file
dio_seek($fd, -2, SEEK_CUR);
// position is now at 8 characters from the start of the file
dio_seek($fd, -5, SEEK_END);
// position is now at 5 characters from the end of the file
dio_seek($fd, 10, SEEK_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 zeros.
dio_close($fd);
?>