FileClose: Difference between revisions
Jump to navigation
Jump to search
Line 29: | Line 29: | ||
==See also== | ==See also== | ||
{{File_functions}} | {{File_functions}} | ||
Revision as of 07:25, 10 June 2011
Closes a file handled by fileCreate or fileOpen.
Syntax
bool fileClose ( file theFile )
Required arguments
- theFile: the file handle to close.
Returns
Returns true if succesfully, false otherwise.
Example
This example creates a new text file and writes an string in it.
local newFile = fileCreate("test.txt") -- Try creating the file. if newFile then -- Check if was sucessfully created. fileWrite(newFile, "This is a test file!") -- Write a text line. fileClose(newFile) -- Close the file after writing in it. end
It is important to remember to close the file after done in all operations. Especially if you wrote something in it. If you do not close the file and the resource crash all changes are lost.
See also
- fileClose
- fileCopy
- fileCreate
- fileDelete
- fileExists
- fileFlush
- fileGetPath
- fileGetPos
- fileGetSize
- fileIsEOF
- fileOpen
- fileRead
- fileRename
- fileSetPos
- fileWrite