Annotation of embedaddon/php/ext/zlib/tests/gzseek_variation2.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test function gzseek() by calling it with SEEK_SET when reading
! 3: --SKIPIF--
! 4: <?php
! 5: if (!extension_loaded("zlib")) {
! 6: print "skip - ZLIB extension not loaded";
! 7: }
! 8: ?>
! 9: --FILE--
! 10: <?php
! 11: $f = dirname(__FILE__)."/004.txt.gz";
! 12: $h = gzopen($f, 'r');
! 13:
! 14: echo "move to the 50th byte\n";
! 15: var_dump(gzseek( $h, 50, SEEK_SET ) );
! 16: echo "tell=".gztell($h)."\n";
! 17: //read the next 10
! 18: var_dump(gzread($h, 10));
! 19:
! 20: echo "\nmove forward to the 100th byte\n";
! 21: var_dump(gzseek( $h, 100, SEEK_SET ) );
! 22: echo "tell=".gztell($h)."\n";
! 23: //read the next 10
! 24: var_dump(gzread($h, 10));
! 25:
! 26: echo "\nmove backward to the 20th byte\n";
! 27: var_dump(gzseek( $h, 20, SEEK_SET ) );
! 28: echo "tell=".gztell($h)."\n";
! 29: //read the next 10
! 30: var_dump(gzread($h, 10));
! 31: gzclose($h);
! 32: ?>
! 33: ===DONE===
! 34: --EXPECT--
! 35: move to the 50th byte
! 36: int(0)
! 37: tell=50
! 38: string(10) " high abov"
! 39:
! 40: move forward to the 100th byte
! 41: int(0)
! 42: tell=100
! 43: string(10) "Destiny wh"
! 44:
! 45: move backward to the 20th byte
! 46: int(0)
! 47: tell=20
! 48: string(10) "hrough fee"
! 49: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>