Join Up!
104886 members and counting!

 
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links 
search for in the  
previousfreadfseeknext
Last updated: Sun, 27 Oct 2002
view the printer friendly version or the printer friendly version with notes or change language to Finnish | German | Spanish

fscanf

(PHP 4 >= 4.0.1)

fscanf -- Parsuje vstup ze souboru podle formátu

Popis

mixed fscanf ( int handle, string format [, string var1])

Funkce fscanf() je podobná sscanf(), ale načítá ze souboru specifikovaného handle a interpretuje vstupní data podle specifikovaného formátu format. Pokud má funkce pouze dva parametry, parsované hodnoty bude vráceny jako pole. Jinak, když jsou použity nepovinné parametry, funkce vrací určitý počet asignovaných hodnot. Nepovinné parametry musí být vloženy odkazem.

Příklad 1. fscanf() Příklad

$fp = fopen ("users.txt","r");
while ($userinfo = fscanf ($fp, "%s\t%s\t%s\n")) {
    list ($name, $profession, $countrycode) = $userinfo;
    //... udelej neco s hodnotami
}
fclose($fp);

Příklad 2. users.txt

javier  argonaut        pe
hiroshi sculptor        jp
robert  slacker us
luigi   florist it

Viz také fread(), fgets(), fgetss(), sscanf(), printf(), a sprintf().

User Contributed Notes
fscanf
add a note about notes
There are no user contributed notes for this page.
previousfreadfseeknext
Last updated: Sun, 27 Oct 2002
Copyright © 2001, 2002 The PHP Group
All rights reserved.
This mirror generously provided by: http://phpbuilder.com/
Last updated: Thu Oct 31 18:34:28 2002 EST