note 56076 added to function.sscanf

From: Date: Mon, 22 Aug 2005 20:49:48 +0000
Subject: note 56076 added to function.sscanf
Groups: php.notes 
Request: Send a blank email to php-notes+get-94046@lists.php.net to get a copy of this message
The %[^[]]-trick may seem to work, but it doesn't! What happens is that sscanf will simply match any characters but an opening square bracket (which is rather rare and that's why it might just seem to work). But even worse it will expect a ]-character next and continue to match anything. Now what you can do is make sscanf look for any character but a character that is really never used... a good choice is the linebreak "%[^\\n]", especially in combination with fscanf. What you can also do is copy and paste any unused ascii character like #001 or something. ---- Manual Page -- http://www.php.net/manual/en/function.sscanf.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56076 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56076&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56076&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56076&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56076&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56076&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56076&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56076&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#94046) next »