You are here: [PHP]Gunzip problem « PHP « IT news, forums, messages
[PHP]Gunzip problem

Posted by Oskar on 04/20/05 13:09

Hello,

I have txt file "text.txt" that contains:
line1:one
line2:two
line3:three
line4:

Line 4 contains empty string.

If I use f*() functions to read from the file:
$handle=fopen("text.txt","r");
while (!feof($handle)) echo("-".chop(fgets($handle))."-<BR>");
fclose($handle);

the RESULT will be:
-one-
-two-
-three-
--

I gzipped the file using ZLIB functions.

If I use gz*() function to read from the gzip file:
$handle=gzopen("text.txt.gz","r");
while (!gzeof($handle)) echo("-".chop(gzgets($handle))."-<BR>");
gzclose($handle);

the RESULT will be:
-one-
-two-
-three-

SEE? The last (empty) line is not returned .

What am I doing wrong?

OKi98

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация