<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/PT-BR/fileWrite?action=history&amp;feed=atom</id>
	<title>PT-BR/fileWrite - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/PT-BR/fileWrite?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PT-BR/fileWrite&amp;action=history"/>
	<updated>2026-04-09T11:48:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://wiki.multitheftauto.com/index.php?title=PT-BR/fileWrite&amp;diff=78724&amp;oldid=prev</id>
		<title>Lettify: Created page with &quot;__NOTOC__ {{BR/Funcao compartilhada}} Escreve uma ou mais strings para um determinado arquivo, iniciando na posição de leitura/gravação atual. A posição avança de acordo com o número de bytes que estiver sendo escrito.  ==Sintaxe== &lt;syntaxhighlight lang=&quot;lua&quot;&gt; int fileWrite ( file theFile, string string1 [, string string2, string string3 ...]) &lt;/syntaxhighlight&gt;  {{PT-BR/POO||file:write}}  ===Argumentos necessários=== *'''theFile:''' O '''arquivo''' no qual...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PT-BR/fileWrite&amp;diff=78724&amp;oldid=prev"/>
		<updated>2023-12-20T20:15:21Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ {{BR/Funcao compartilhada}} Escreve uma ou mais strings para um determinado arquivo, iniciando na posição de leitura/gravação atual. A posição avança de acordo com o número de bytes que estiver sendo escrito.  ==Sintaxe== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; int fileWrite ( file theFile, string string1 [, string string2, string string3 ...]) &amp;lt;/syntaxhighlight&amp;gt;  {{PT-BR/POO||&lt;a href=&quot;/index.php?title=File&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;File (page does not exist)&quot;&gt;file&lt;/a&gt;:write}}  ===Argumentos necessários=== *&amp;#039;&amp;#039;&amp;#039;theFile:&amp;#039;&amp;#039;&amp;#039; O &amp;#039;&amp;#039;&amp;#039;arquivo&amp;#039;&amp;#039;&amp;#039; no qual...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
{{BR/Funcao compartilhada}}&lt;br /&gt;
Escreve uma ou mais strings para um determinado arquivo, iniciando na posição de leitura/gravação atual. A posição avança de acordo com o número de bytes que estiver sendo escrito.&lt;br /&gt;
&lt;br /&gt;
==Sintaxe==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
int fileWrite ( file theFile, string string1 [, string string2, string string3 ...])&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{PT-BR/POO||[[file]]:write}}&lt;br /&gt;
&lt;br /&gt;
===Argumentos necessários===&lt;br /&gt;
*'''theFile:''' O '''arquivo''' no qual deseja escrever. O arquivo deve estar aberto com acessos de escrita, ou seja, esse '''arquivo''' deve ser retornado de [[PT-BR/fileCreate|fileCreate]] ou [[PT-BR/fileOpen|fileOpen]] com o argumento '''readonly''' (modo leitura) definido para '''false'''.&lt;br /&gt;
*'''string1:''' O texto que quer escrever no arquivo.&lt;br /&gt;
&lt;br /&gt;
===Argumento opcional===&lt;br /&gt;
*Você pode especificar quantas strings adicionais que quiser depois de '''string1'''. Essas strings serão escritas na ordem que estiverem sendo especificadas.&lt;br /&gt;
&lt;br /&gt;
===Retorno===&lt;br /&gt;
Retorna o ''número'' de bytes que foram escritos com sucesso no arquivo, retorna '''false''' se argumentos inválidos forem especificados.&lt;br /&gt;
&lt;br /&gt;
==Exemplo==&lt;br /&gt;
Este exemplo cria um arquivo de texto e escreve um texto nele.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local fileHandle = fileCreate(&amp;quot;test.txt&amp;quot;)             -- tentamos criar um novo arquivo&lt;br /&gt;
if fileHandle then                                    -- verificamos se o arquivo foi criado&lt;br /&gt;
    fileWrite(fileHandle, &amp;quot;This is a test file!&amp;quot;)     -- escrevemos a linha de texto&lt;br /&gt;
    fileClose(fileHandle)                             -- fechamos o arquivo depois de trabalhar nele&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Observe que você não pode simplesmente fazer dessa forma: &amp;lt;code&amp;gt;fileWrite(&amp;quot;test.txt&amp;quot;, &amp;quot;File content&amp;quot;)&amp;lt;/code&amp;gt;. Em vez disso, as funções que manipulam os arquivos operam com o '''arquivo''', que é um objeto especial representando o arquivo aberto.&lt;br /&gt;
&lt;br /&gt;
É importante também lembrar de fechar o arquivo depois que você terminar de fazer tudo o que precisa com ele, especialmente se você tiver escrito algo nesse arquivo. Se não fechá-lo e o resource travar de alguma forma, todas as mudanças no arquivo podem ser perdidas.&lt;br /&gt;
==Veja também==&lt;br /&gt;
{{PT-BR/File functions}}&lt;/div&gt;</summary>
		<author><name>Lettify</name></author>
	</entry>
</feed>