fscanf

fscanf -- Parses input from a file according to a format

Description

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

דוגמה 1 . fscanf( ) Example

 
$fp

 
=

 
fopen

 
(

 
"users.txt"

 
,"r")

 
;

 
while

 
($userinfo

 
=

 
fscanf

 
($fp

 
,

 
"%s\t%s\t%s\n")

 
)

 
{

 
list

 
($name

 
,

 
$profession

 
,

 
$countrycode

 
)

 
=

 
$userinfo

 
;

 
/

 
/..

 
.

 
do

 
something

 
with

 
the

 
values

 
}

 
fclose($fp)

 
;



דוגמה 2 . users.txt