|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-08-10 21:45 UTC] sagawa at sohgoh dot net
Quote from Linux Programmer's Manual fseek(3)... >RETURN VALUES > The rewind function returns no value. Upon successful > completion, fgetpos, fseek, fsetpos return 0, and ftell > returns the current offset. Otherwise, -1 is returned and > the global variable errno is set to indicate the error. So, we get 0(=false) if file position is begining of file. But that's not error. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 06 02:00:01 2025 UTC |
Umm... what I want to say, PHP's ftell function returns directly C's ftell(). So, this is "Documentation problem", isn't it? Please see below... (Quote from /ext/standerd/file.c ) ----------------------------------- /* {{{ proto int fseek(int fp, int offset [, int whence]) Seek on a file pointer */ PHP_FUNCTION(fseek) { zval **arg1, **arg2, **arg3; int argcount = ARG_COUNT(ht), whence = SEEK_SET; void *what; if (argcount < 2 || argcount > 3 || zend_get_parameters_ex(argcount, &arg1, &arg2, &arg3) == FAILURE) { WRONG_PARAM_COUNT; } what = zend_fetch_resource(arg1,-1,"File-Handle",NULL,2,le_fopen,le_popen); ZEND_VERIFY_RESOURCE(what); convert_to_long_ex(arg2); if (argcount > 2) { convert_to_long_ex(arg3); whence = (*arg3)->value.lval; } RETURN_LONG(fseek((FILE*)what, (*arg2)->value.lval, whence)); } /* }}} */ -----------------------------------