ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. fileRead

Function

fileRead

Server and clientFilesIdentical to MTA:SA

Reads the given number of bytes from the current position and moves the position. At the end of the file it returns an empty string. Binary data is returned unchanged.

Syntax

string fileRead(file theFile, int count)

Arguments

theFilefile
A file handle.
countint
Number of bytes.

Returns

The data read, or false.

Example

local file = fileOpen("data.bin", true)
if file then
    while not fileIsEOF(file) do
        local chunk = fileRead(file, 500)
        outputDebugString(#chunk .. " bajtow")
    end
    fileClose(file)
end

See also