PHP ��U
前一頁 |  | 下一頁

# php_stream_seek

php_stream_seek -- Reposition a stream

## Description

int php_stream_seek ( php_stream * stream, off_t offset, int whence )

php_stream_seek() repositions the internal position of stream. The new position is determined by adding the offset to the position indicated by whence. If whence is set to `SEEK_SET`, `SEEK_CUR` or `SEEK_END` the offset is relative to the start of the stream, the current position or the end of the stream, respectively.

php_stream_seek() returns 0 on success, but -1 if there was an error.

> 注: Not all streams support seeking, although the streams API will emulate a seek if whence is set to `SEEK_CUR` and offset is positive, by calling php_stream_read() to read (and discard) offset bytes.

> The emulation is only applied when the underlying stream implementation does not support seeking. If the stream is (for example) a file based stream that is wrapping a non-seekable pipe, the streams api will not apply emulation because the file based stream implements a seek operation; the seek will fail and an error result will be returned to the caller.

前一頁 | 內容 | 下一頁
php_stream_flush | 上一層 | php_stream_tell