2fbfe8256dcc5ff5ea082a7d004af4f641a50605
[scilab.git] / scilab / modules / io / help / pt_BR / file.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4  * Copyright (C) XXXX-2008 - INRIA
5  * Copyright (C) 2012 - 2016 - Scilab Enterprises
6  * Copyright (C) 2018 - Samuel GOUGEON
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14  *
15  -->
16 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
17           xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
18           xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
19           xmlns:scilab="http://www.scilab.org" xml:id="file" xml:lang="pt">
20     <refnamediv>
21         <refname>file</refname>
22         <refpurpose>Gerenciamento de arquivos</refpurpose>
23     </refnamediv>
24     <refsynopsisdiv>
25         <title>Seqüência de Chamamento</title>
26         <synopsis>
27             [unit, err] = file("open", file-name [,status] [,access [,recl]] [,format])
28             file("close", unit)
29             file("rewind", unit)
30             file("backspace", unit)
31             file("last", unit)
32             [units, typ, nams, mod, swap] = file()
33             [units, typ, nams, mod, swap] = file(unit)
34         </synopsis>
35     </refsynopsisdiv>
36     <refsection>
37         <title>Parâmetros</title>
38         <variablelist>
39             <varlistentry>
40                 <term>file-name</term>
41                 <listitem>
42                     <para>string, nome o arquivo a ser aberto</para>
43                     <warning>
44                         This function can not open files whose path has non-ascii
45                         UTF characters (accented, etc). In this case, please use mopen.
46                     </warning>
47                 </listitem>
48             </varlistentry>
49             <varlistentry>
50                 <term>status</term>
51                 <listitem>
52                     <para>string, o status do arquivo a ser aberto</para>
53                     <variablelist>
54                         <varlistentry>
55                             <term>"new"</term>
56                             <listitem>
57                                 <para>o arquivo não deve existir, novo arquivo (padrão)</para>
58                             </listitem>
59                         </varlistentry>
60                         <varlistentry>
61                             <term>"old"</term>
62                             <listitem>
63                                 <para>o arquivo já deve existir</para>
64                             </listitem>
65                         </varlistentry>
66                         <varlistentry>
67                             <term>"unknown"</term>
68                             <listitem>
69                                 <para>status desconhecido</para>
70                             </listitem>
71                         </varlistentry>
72                         <varlistentry>
73                             <term>"scratch"</term>
74                             <listitem>
75                                 <para>o arquivo deve ser deletado ao fim da sessão</para>
76                             </listitem>
77                         </varlistentry>
78                     </variablelist>
79                 </listitem>
80             </varlistentry>
81             <varlistentry>
82                 <term>access</term>
83                 <listitem>
84                     <para>string, o tipo de acesso ao arquivo</para>
85                     <variablelist>
86                         <varlistentry>
87                             <term>"sequential"</term>
88                             <listitem>
89                                 <para>acesso seqüencial (padrão)</para>
90                             </listitem>
91                         </varlistentry>
92                         <varlistentry>
93                             <term>"direct"</term>
94                             <listitem>
95                                 <para>acesso direto</para>
96                             </listitem>
97                         </varlistentry>
98                     </variablelist>
99                 </listitem>
100             </varlistentry>
101             <varlistentry>
102                 <term>format</term>
103                 <listitem>
104                     <para>string,</para>
105                     <variablelist>
106                         <varlistentry>
107                             <term>"formatted"</term>
108                             <listitem>
109                                 <para>para um arquivo formatado (padrão)</para>
110                             </listitem>
111                         </varlistentry>
112                         <varlistentry>
113                             <term>"unformatted"</term>
114                             <listitem>
115                                 <para>registro binário</para>
116                             </listitem>
117                         </varlistentry>
118                     </variablelist>
119                 </listitem>
120             </varlistentry>
121             <varlistentry>
122                 <term>recl</term>
123                 <listitem>
124                     <para>inteiro, é o tamanho de registros quando
125                         <literal>access="direct"</literal>
126                     </para>
127                 </listitem>
128             </varlistentry>
129             <varlistentry>
130                 <term>unit</term>
131                 <listitem>
132                     <para>inteiro, descritor de unidade lógica do arquivo aberto</para>
133                 </listitem>
134             </varlistentry>
135             <varlistentry>
136                 <term>units</term>
137                 <listitem>
138                     <para>vetor de inteiros, descritores de unidades lógicas dos
139                         arquivos abertos. As unidades 5 e 6 são reservadas pelo sistema para
140                         dispositivos de entrada e saída.
141                     </para>
142                 </listitem>
143             </varlistentry>
144             <varlistentry>
145                 <term>typs</term>
146                 <listitem>
147                     <para>vetor de strings, tipo (C ou Fortran) dos arquivos
148                         abertos.
149                     </para>
150                 </listitem>
151             </varlistentry>
152             <varlistentry>
153                 <term>nams</term>
154                 <listitem>
155                     <para>vetor de strings, endereços dos arquivos abertos.</para>
156                 </listitem>
157             </varlistentry>
158             <varlistentry>
159                 <term>mod</term>
160                 <listitem>
161                     <para>modo de abertura de arquivo. Formado por três dígitos abc:
162                     </para>
163                     <table border="0">
164                         <tr valign="top">
165                             <th colspan="2">Arquivos Fortran</th>
166                         </tr>
167                         <tr valign="top">
168                             <th>a</th>
169                             <td>0 significa formatado e 1 não formatado (binário)</td>
170                         </tr>
171                         <tr valign="top">
172                             <th>b</th>
173                             <td>0 significa acesso sequencial e 1 acesso direto</td>
174                         </tr>
175                         <tr valign="top">
176                             <th>c</th>
177                             <td>0 significa "new", 1 significa "old", 2 significa "scratch" e 3
178                                 significa "unknown"
179                             </td>
180                         </tr>
181                         <tr valign="top">
182                             <th colspan="2">Arquivos C</th>
183                         </tr>
184                         <tr valign="top">
185                             <th>a</th>
186                             <td>1 significa "r" (leitura), 2 significa "w" (escrita) e 3 significa
187                                 "a" (anexação)</td>
188                         </tr>
189                         <tr valign="top">
190                             <th>b</th>
191                             <td>é 1 se o arquivo foi aberto pelo modo "+" (atualização)</td>
192                         </tr>
193                         <tr valign="top">
194                             <th>c</th>
195                             <td>é 1 se o arquivo foi aberto pelo modo "b" (binário)</td>
196                         </tr>
197                     </table>
198                 </listitem>
199             </varlistentry>
200             <varlistentry>
201                 <term>swap</term>
202                 <listitem>
203                     <para>alavanca de troca automática. swap=1 se a troca automática
204                         estiver ativada. swap é sempre 0 para arquivos Fortran.
205                     </para>
206                 </listitem>
207             </varlistentry>
208             <varlistentry>
209                 <term>err</term>
210                 <listitem>
211                     <para>
212                     </para>
213                     <para>inteiro, número de erro, se a abertura falha. Se <varname>err</varname>
214                     for omitido, uma mensagem de erro aparece.
215                     </para>
216                     <table>
217                         <tr valign="top"><th>65</th><td>File already used</td></tr>
218                         <tr valign="top"><th>66</th><td>Too many files opened!</td></tr>
219                         <tr valign="top"><th>67</th><td>Unknown file format</td></tr>
220                         <tr valign="top"><th>240</th>
221                                          <td>The file already exists or directory write
222                                              access denied.</td></tr>
223                         <tr valign="top"><th>241</th><td>The file does not exist or read access denied.</td></tr>
224                     </table>
225                 </listitem>
226             </varlistentry>
227             <varlistentry>
228                 <term>action</term>
229                 <listitem>
230                     <para>é um dos seguintes strings:</para>
231                     <variablelist>
232                         <varlistentry>
233                             <term>"close"</term>
234                             <listitem>
235                                 <para>fecha os arquivos fornecidos pelos descritores de
236                                     unidades lógicas fornecidos em <literal>units</literal>
237                                 </para>
238                             </listitem>
239                         </varlistentry>
240                         <varlistentry>
241                             <term>"rewind"</term>
242                             <listitem>
243                                 <para>coloca o ponteiro no início do arquivo</para>
244                             </listitem>
245                         </varlistentry>
246                         <varlistentry>
247                             <term>"backspace"</term>
248                             <listitem>
249                                 <para>coloca o ponteiro no início do último registro.</para>
250                             </listitem>
251                         </varlistentry>
252                         <varlistentry>
253                             <term>"last"</term>
254                             <listitem>
255                                 <para>coloca o ponteiro após o último registro.</para>
256                             </listitem>
257                         </varlistentry>
258                     </variablelist>
259                 </listitem>
260             </varlistentry>
261         </variablelist>
262     </refsection>
263     <refsection>
264         <title>Descrição</title>
265         <para>
266             Seleciona uma unidade lógica <literal>unit</literal> e gerencia o
267             arquivo <literal>file-name</literal>.
268         </para>
269         <para>
270             <literal>[unit [,err]]=file('open', file-name [,status] [,access
271                 [,recl]][,format])
272             </literal>
273             permite abrir um arquivo com propriedades
274             especificadas e obter o número de unidade associado
275             <literal>unit</literal>. Este número de unidade pode ser utilizado para
276             ações futuras no arquivo, ou como descritor de arquivo em chamadas às
277             funções <literal>read</literal>, <literal>write</literal>,
278             <literal>readb</literal>,
279             <literal>writb</literal>,<literal>save</literal>,
280             <literal>load</literal>.
281         </para>
282         <para>
283             <literal>file(action,unit)</literal> permite fechar o arquivo, ou
284             mover o ponteiro do arquivo corrente.
285         </para>
286         <para>
287             <literal>file()</literal> retorna os descritores dos arquivos abertos.
288         </para>
289         <para>To test whether a file  #<literal>id</literal> is opened,
290             <literal>file(id)~=[]</literal> may be used.
291         </para>
292         <para>
293             <literal>file('close',file() )</literal> fecha
294             todos os arquivos do usuário abertos (tipo C ou Fortran).
295         </para>
296     </refsection>
297     <refsection>
298         <title>Exemplos</title>
299         <programlisting role="example"><![CDATA[
300 u=file('open',TMPDIR+'/foo','unknown')
301 for k=1:4
302   a=rand(1,4)
303   write(u,a)
304 end
305 file('rewind',u)
306 x=read(u,2,4)
307 file('close',u)
308 //
309 u1=file('open',TMPDIR+'/foo','unknown')
310 u2=mopen(TMPDIR+'/foo1','wb')
311 [units,typs,nams]=file()
312 file('close',u1);
313 mclose(u2);
314  ]]></programlisting>
315     </refsection>
316     <refsection role="see also">
317         <title>Ver Também</title>
318         <simplelist type="inline">
319             <member>
320                 <link linkend="isfile">isfile</link>
321             </member>
322             <member>
323                 <link linkend="read">read</link>
324             </member>
325             <member>
326                 <link linkend="readb">readb</link>
327             </member>
328             <member>
329                 <link linkend="write">write</link>
330             </member>
331             <member>
332                 <link linkend="writb">writb</link>
333             </member>
334             <member>
335                 <link linkend="mopen">mopen</link>
336             </member>
337             <member>
338                 <link linkend="save">save</link>
339             </member>
340             <member>
341                 <link linkend="load">load</link>
342             </member>
343             <member>
344                 <link linkend="uigetfile">uigetfile</link>
345             </member>
346         </simplelist>
347     </refsection>
348     <refsection role="history">
349         <title>Histórico</title>
350         <revhistory>
351             <revision>
352                 <revnumber>6.0.0</revnumber>
353                 <revdescription>
354                     stderr is inserted in the output of file() as units(1)=0, typ(1)="STD" and
355                     nams(1)="stderr".
356                 </revdescription>
357             </revision>
358         </revhistory>
359     </refsection>
360 </refentry>