Bug #12337 Updated: Function fscanf does not correctly handle "\t" in format string

From: Date: Mon, 11 Feb 2002 00:27:33 +0000
Subject: Bug #12337 Updated: Function fscanf does not correctly handle "\t" in format string
References: 1  Groups: php.bugs php.doc 
Request: Send a blank email to php-bugs+get-90@lists.php.net to get a copy of this message
ID: 12337 Updated by: elixer@php.net -Summary: Function fscanf does not correctly handle "\t" in format string Reported By: premysl.dedic@conquest.cz Status: Open -Bug Type: Filesystem function related +Bug Type: Documentation problem Operating System: Linux RedHat 6.2 PHP Version: 4.0.4pl1 New Comment: Whitespace characters (be they space, tab, or newline, etc.) in the format string matche one or more whitespace characters in the input. So the second \t in your format string is matching the space between 'def' and 'ghi.' The sample file from the documentation does not include "embedded whitespace" in the different data columns as yours does. I'm changing this to a documentation problem because the (f)scanf documentation is really lacking. Sean Previous Comments: ------------------------------------------------------------------------ [2001-07-24 09:45:17] premysl.dedic@conquest.cz When I copy&paste sample from documentation of fscanf function, I found, that it work incorrectly: Sample: while ($userinfo = fscanf ($fp, "%s\t%s\t%s\n")) { list ($name, $profession, $countrycode) = $userinfo; } Sample file: abc<tab>def ghi jkl<tab> ..... <newline> Note: <tab> means here a "tabelator" character (\t) Result: $name = 'abc' $profession = 'def'; $contrycode = 'jkl'; I expect: $name = 'abc' $profession = 'def ghi jkl'; $contrycode = ' .... '; What si wrong??? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=12337&edit=1

« previous php.bugs (#90) next »