PT-BR/fileGetSize
Jump to navigation
Jump to search
Retorna o tamanho total (em bytes) de determinado arquivo.
Sintaxe
int fileGetSize ( file theFile )
Sintaxe POO(OOP) Não entendeu o que significa isso?
- Método: file:getSize(...)
- Variável: .size
Argumentos necessários
- theFile: o arquivo que você deseja obter o tamanho total.
Retorno
Retorna o tamanho do arquivo se tiver sido executado com sucesso, ou false se tiver ocorrido algum erro (ex.: um arquivo inválido for especificado)
Exemplo
local newFile = fileCreate("test.txt") -- tentamos criar um novo arquivo
if (newFile) then -- verificamos se foi criado com sucesso
fileWrite(newFile, "This is a test file!") -- escrevemos uma linha de texto
local size = fileGetSize(newFile) -- obtemos o tamanho
if size then
outputChatBox("Size of test.txt is: "..size, source) -- exibimos o tamanho
end
fileClose(newFile) -- fechamos o arquivo depois de trabalharmos com ele
end
Veja também
- fileClose
- fileCopy
- fileCreate
- fileDelete
- fileExists
- fileFlush
- fileGetPath
- fileGetPos
- fileGetSize
- fileIsEOF
- fileOpen
- fileRead
- fileRename
- fileSetPos
- fileWrite