WriteFile
From OxeyeWiki
(Difference between revisions)
m |
|||
| Line 1: | Line 1: | ||
{{File}} The WriteFile class will create a binary file for writing. | {{File}} The WriteFile class will create a binary file for writing. | ||
| + | |||
| + | You create a file by calling the constructor WriteFile(location, mode). The location should be the file name (except for memory mode), and mode should be a string which is either "f" (file), "z" (compressed file) or "m" (write to memory). | ||
=== Example === | === Example === | ||
| Line 5: | Line 7: | ||
local path = daisy.getUserFolderPath("") | local path = daisy.getUserFolderPath("") | ||
| - | local file = WriteFile(path .. filename) | + | local file = WriteFile(path .. filename, "f") |
file:writeInt(fileVersion) | file:writeInt(fileVersion) | ||
Latest revision as of 18:32, 7 February 2010
| DaisyMoon File Objects |
|---|
You create a file by calling the constructor WriteFile(location, mode). The location should be the file name (except for memory mode), and mode should be a string which is either "f" (file), "z" (compressed file) or "m" (write to memory).
Example
local path = daisy.getUserFolderPath("")
local file = WriteFile(path .. filename, "f")
file:writeInt(fileVersion)
file:writeString(playerName)
-- ... and so on ...
file:close()