Re: Stop At Return

From: Date: Thu, 31 Oct 2002 16:49:45 +0000
Subject: Re: Stop At Return
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-122278@lists.php.net to get a copy of this message
Try fgets()... fread() is binary safe, so it doesn't terminate at \x0d\x0a. fges, on the other hand, does. On Thursday 31 October 2002 08:41 am, Adam Voigt wrote: > I'm running PHP in console mode, on a script which uses: > > $f = fopen("php://stdin","r"); > $data = fread($f,12); > fclose($f); > > To get an IP address (a max of 12 characters), so the question > is, how do I stop taking input when they hit return (ie, if > there IP is less then the max 12 it will keep waiting for 12 > characters of input) any ideas? (Other then to loop through > taking what character at a time checking to see if it's the > return key.)? > > Adam Voigt > adam.voigt@cryptocomm.com -- The world holds two classes of men -- intelligent men without religion, and religious men without intelligence. -Abu'l-Ala-Al-Ma'arri

« previous php.general (#122278) next »