|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-10-17 12:07 UTC] holliwell at gmx dot net
Hi, maybe only a doc problem. fgetc seems to be binary safe, while fgets not. assume: fopen a lokal file, read it with fgetc or fgets, you'll get bogus results with fgets if the opened file contains \0 Friedhelm Betz PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 19 18:00:02 2025 UTC |
Hi,frined, I am Mr Wang Zhan Feng. I think the bug on fgetc still existing. see my program: test2.php: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <style type="text/css"> <!-- body { margin-left: 10px; margin-right: 10px; margin-top: 16px; margin-bottom: 16px } --> </style> <!-- #!/usr/local/bin/php --> </head> <body> <?php error_reporting(E_ALL); $ifp=fopen("test2.php","rb"); while(true){ $ic=fgetc($ifp); if($ic == false)break; print $ic; } fclose($ifp); ?> </body> </html> Every time, the program run to 0, then it will stop, I tried to change to other number, then it is OK. I am testing on PHP ver 5.0.1 Thanks.