note 102994 added to function.fseek
| From: | Anonymous at osu1 dot php dot net | Date: | Sat, 19 Mar 2011 02:56:10 +0000 |
| Subject: | note 102994 added to function.fseek | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-177995@lists.php.net to get a copy of this message | ||
The official docs indicate that not all streams are seekable.
You can try to seek anyway and handle failure:
<?php
if (fseek($stream, $offset, SEEK_CUR) === -1) {
// whatever
}
?>
Or, you can use the stream_get_meta_data function:
http://php.net/stream_get_meta_data
<?php
function fseekable($stream) {
$meta = stream_get_meta_data($stream);
return $meta['seekable'];
}
?>
----
Server IP: 192.41.42.26
Probable Submitter: 99.121.83.201
----
Manual Page -- http://www.php.net/manual/en/function.fseek.php
Edit -- https://master.php.net/note/edit/102994
Del: integrated -- https://master.php.net/note/delete/102994/integrated
Del: useless -- https://master.php.net/note/delete/102994/useless
Del: bad code -- https://master.php.net/note/delete/102994/bad+code
Del: spam -- https://master.php.net/note/delete/102994/spam
Del: non-english -- https://master.php.net/note/delete/102994/non-english
Del: in docs -- https://master.php.net/note/delete/102994/in+docs
Del: other reasons-- https://master.php.net/note/delete/102994
Reject -- https://master.php.net/note/reject/102994
Search -- https://master.php.net/manage/user-notes.php