implement ftell stream wrapper and fix return value from fseek stream wrapper
This commit is contained in:
parent
c955381d56
commit
d9668977cd
|
@ -163,15 +163,26 @@ class Stream {
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the current position of the file pointer
|
||||
* @return int position of the file pointer
|
||||
*/
|
||||
public function stream_tell() {
|
||||
return ftell($this->handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $offset
|
||||
* @param int $whence
|
||||
* @return bool true if fseek was successful, otherwise false
|
||||
*/
|
||||
public function stream_seek($offset, $whence = SEEK_SET) {
|
||||
|
||||
$this->flush();
|
||||
|
||||
fseek($this->handle, $offset, $whence);
|
||||
// this wrapper needs to return "true" for success.
|
||||
// the fseek call itself returns 0 on succeess
|
||||
return !fseek($this->handle, $offset, $whence);
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue