Lua:createFileStream
Jump to navigation
Jump to search
Creates a stream backed by a file.
Use fmCreate, fmOpenRead, fmOpenWrite, or fmOpenReadWrite as the base mode. Sharing flags can be combined with the mode.
Function Parameters
| Parameter | Type | Description |
|---|---|---|
| filename | String | Path of the file to create or open. |
| mode | Integer | File mode constant, optionally combined with a sharing flag. |
Returns
FileStream — The opened file stream.
Examples
1 local stream = createFileStream("C:\\Temp\\output.bin", fmCreate)
2 stream.writeByte(0x42)
3 stream.destroy()