[PHP] Stop At Return

2002-10-31 Thread Adam Voigt
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

Re: [PHP] Stop At Return

2002-10-31 Thread Evan Nemerson
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