<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.multitheftauto.com/wiki/PT-BR/fileSetPos?action=history&amp;feed=atom</id>
	<title>PT-BR/fileSetPos - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.multitheftauto.com/wiki/PT-BR/fileSetPos?action=history&amp;feed=atom"/>
	<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PT-BR/fileSetPos&amp;action=history"/>
	<updated>2026-04-06T07:43:19Z</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/fileSetPos&amp;diff=78722&amp;oldid=prev</id>
		<title>Lettify: Created page with &quot;__NOTOC__ {{BR/Funcao compartilhada}}  Define a posição atual para leitura/gravação no arquivo.  ==Sintaxe== &lt;syntaxhighlight lang=&quot;lua&quot;&gt; int fileSetPos ( file theFile, int offset ) &lt;/syntaxhighlight&gt;  {{PT-BR/POO||file:setPos|pos|PT-BR/fileGetPos}}  ===Argumentos necessários=== *'''theFile:''' O '''arquivo''' que você quer mudar a posição de leitura/gravação. *'''offset:''' A nova posição. Este é o número de bytes partindo do início do arquivo. Se est...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.multitheftauto.com/index.php?title=PT-BR/fileSetPos&amp;diff=78722&amp;oldid=prev"/>
		<updated>2023-12-20T20:03:27Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ {{BR/Funcao compartilhada}}  Define a posição atual para leitura/gravação no arquivo.  ==Sintaxe== &amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt; int fileSetPos ( file theFile, int offset ) &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;:setPos|pos|PT-BR/fileGetPos}}  ===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; que você quer mudar a posição de leitura/gravação. *&amp;#039;&amp;#039;&amp;#039;offset:&amp;#039;&amp;#039;&amp;#039; A nova posição. Este é o número de bytes partindo do início do arquivo. Se est...&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;
&lt;br /&gt;
Define a posição atual para leitura/gravação no arquivo.&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 fileSetPos ( file theFile, int offset )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{PT-BR/POO||[[file]]:setPos|pos|PT-BR/fileGetPos}}&lt;br /&gt;
&lt;br /&gt;
===Argumentos necessários===&lt;br /&gt;
*'''theFile:''' O '''arquivo''' que você quer mudar a posição de leitura/gravação.&lt;br /&gt;
*'''offset:''' A nova posição. Este é o número de bytes partindo do início do arquivo. Se este número for maior que o tamanho do arquivo, então será limitado para 52,428,800 bytes (50 MB).&lt;br /&gt;
&lt;br /&gt;
===Retorno===&lt;br /&gt;
Retorna onde realmente foi definido o ''offset''. Ou seja, se ''offset'' ultrapassar o final do arquivo, então esse valor será a posição do fim do arquivo, que é o que será retornado. Retorna '''false''' em caso de falha (ex.: o '''arquivo''' especificado for inválido).&lt;br /&gt;
&lt;br /&gt;
==Exemplo==&lt;br /&gt;
Este exemplo abre um arquivo binário e exibe no console o valor do byte na posição 8.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local hFile = fileOpen(&amp;quot;test.dat&amp;quot;)          -- tentamos abrir o arquivo&lt;br /&gt;
if hFile then                               -- verificamos se foi aberto&lt;br /&gt;
    fileSetPos(hFile, 8)                    -- define a posição de leitura/gravação&lt;br /&gt;
    local readByte = fileRead(hFile, 1)     -- faz a leitura de um byte nesta posição&lt;br /&gt;
    outputConsole(&amp;quot;Byte at position 8 = &amp;quot; .. string.byte(readByte))     -- então exibe&lt;br /&gt;
    fileClose(hFile)                        -- fechamos o arquivo&lt;br /&gt;
else&lt;br /&gt;
    outputConsole(&amp;quot;Unable to open test.dat&amp;quot;)&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Veja também==&lt;br /&gt;
{{PT-BR/File functions}}&lt;/div&gt;</summary>
		<author><name>Lettify</name></author>
	</entry>
</feed>