-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathfscanf.xml
97 lines (96 loc) · 3.32 KB
/
fscanf.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?xml version="1.0" encoding="UTF-8"?>
<!-- EN-Revision: n/a Maintainer: fernando Status: working -->
<!-- CREDITS: cortesi -->
<!-- OLD-Revision: 1.134/EN.1.2 -->
<refentry xml:id="function.fscanf" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>fscanf</refname>
<refpurpose>Analizza l'input da un file secondo un determinato formato</refpurpose>
</refnamediv>
<refsect1>
<title>Descrizione</title>
<methodsynopsis>
<type>mixed</type><methodname>fscanf</methodname>
<methodparam><type>resource</type><parameter>handle</parameter></methodparam>
<methodparam><type>string</type><parameter>format</parameter></methodparam>
<methodparam choice="opt"><type>mixed</type><parameter role="reference">...</parameter></methodparam>
</methodsynopsis>
<para>
La funzione <function>fscanf</function> è simile a
<function>sscanf</function>, ma prende il proprio input da un file
associato con <parameter>handle</parameter> e interpreta
l'input in accordo con il parametro
<parameter>format</parameter>, che viene descritto nella documentazione della funzione
<function>sprintf</function>. Se vengono passati solo due parametri
a questa funzione, i valori esaminati verranno restituiti in un vettore.
Altrimenti, se vengono passati i parametri opzionali, la funzione restituirà
il numero dei valori assegnati. I parametri opzionali
devono essere passati da reference.
</para>
<para>
Ogni spazio nella stringa di formato identifica uno spazio nel flusso
di input. Questo significa che anche i tab <literal>\t</literal> presenti nella stringa
di formato possono identiicare uno spazio nel flusso di input.
</para>
<para>
<example>
<title>Esempio di <function>fscanf</function></title>
<programlisting role="php">
<![CDATA[
<?php
$handle = fopen("users.txt", "r");
while ($userinfo = fscanf ($handle, "%s\t%s\t%s\n")) {
list ($name, $profession, $countrycode) = $userinfo;
//... fai quacosa coi valori ...
}
fclose($handle);
?>
]]>
</programlisting>
</example>
<example>
<title>Cntyennts of users.txt</title>
<programlisting role="txt">
<![CDATA[
javier argonaut pe
hiroshi sculptor jp
robert slacker us
luigi florist it
]]>
</programlisting>
</example>
</para>
<note>
<simpara>
Nelle versioni di PHP precedenti alla 4.3.0, il numero massimo di caratteri
letti da un file era di 512 (o fino al primo \n, dipende da quale si incontra prima).
Dal PHP 4.3.0 si possono esaminare linee di lunghezza arbitraria.
</simpara>
</note>
<para>
Vedere anche <function>fread</function>, <function>fgets</function>,
<function>fgetss</function>, <function>sscanf</function>,
<function>printf</function> e <function>sprintf</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->