implement ftell stream wrapper and fix return value from fseek stream wrapper

This commit is contained in:
Bjoern Schiessle 2013-12-18 15:40:43 +01:00
parent c955381d56
commit d9668977cd
1 changed files with 12 additions and 1 deletions

View File

@ -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);
}