note 6068 deleted from function.fgets by wez

From: Date: Fri, 06 Sep 2002 02:30:18 +0000
Subject: note 6068 deleted from function.fgets by wez
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-36219@lists.php.net to get a copy of this message
I was using fgets to get one byte at a time from a file and I was using 1 for the length, e.g. fgets($fp,1). This should give you one character from the file, so I put it in a do while loop which terminates when it finds a space. Using length one does not grab one byte from the file it grabs maybe a space or something, what you need to do to grab a singe byte from a file you need to have length 2, otherwise you will cause the webserver to crash or become extrememly slow.

« previous php.notes (#36219) next »