php man page for fscanf

Query: fscanf

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

FSCANF(3)								 1								 FSCANF(3)

fscanf - Parses input from a file according to a format

SYNOPSIS
mixed fscanf (resource $handle, string $format, [mixed &$...])
DESCRIPTION
The function fscanf(3) is similar to sscanf(3), but it takes its input from a file associated with $handle and interprets the input according to the specified $format, which is described in the documentation for sprintf(3). Any whitespace in the format string matches any whitespace in the input stream. This means that even a tab in the format string can match a single space character in the input stream. Each call to fscanf(3) reads one line from the file.
PARAMETERS
o $handle -A file system pointer resource that is typically created using fopen(3). o $format - The specified format as described in the sprintf(3) documentation. o $... - The optional assigned values.
RETURN VALUES
If only two parameters were passed to this function, the values parsed will be returned as an array. Otherwise, if optional parameters are passed, the function will return the number of assigned values. The optional parameters must be passed by reference.
EXAMPLES
Example #1 fscanf(3) Example <?php $handle = fopen("users.txt", "r"); while ($userinfo = fscanf($handle, "%s %s %s ")) { list ($name, $profession, $countrycode) = $userinfo; //... do something with the values } fclose($handle); ?> Example #2 Contents of users.txt javier argonaut pe hiroshi sculptor jp robert slacker us luigi florist it
SEE ALSO
fread(3), fgets(3), fgetss(3), sscanf(3), printf(3), sprintf(3). PHP Documentation Group FSCANF(3)
Related Man Pages
sscanf(3s) - bsd
fscanf(2) - plan9
scanf(3s) - v7
scanf(3) - minix
fscanf(3int) - ultrix
Similar Topics in the Unix Linux Community
Whole line
fscanf
read a file wich fscanf() in a function
Data formating using C programm with Hex deciamal 'x0d'
C, using fscanf