fileRead
Shared
Reads bytes from a file at the current position and moves the position on.
string fileRead(file file, int count)
Parameters
| Name | Type | Description |
|---|---|---|
| file | file | A file opened by fileOpen or fileCreate. |
| count | int | How many bytes to read, 0 or more. |
Returns
The bytes read. It may hold fewer than count (or be empty) near the end.
Example
local file = fileOpen("data.bin", true)
while file and not fileIsEOF(file) do
local chunk = fileRead(file, 4096)
print(#chunk)
end
if file then fileClose(file) end