Posted 07 May 2012 - 09:52 AM
Hi, the fs api includes everything i could ever need except the art of creating files. Is there another way to do this or store data indefinately?
version = "1.0" -- The version here does not matter because it is
a string, in case you did not know already :)/>/>
file = fs.open("myProgram/version", "w") -- This here will open the
file version in the myProgram directory
in write mode and keep it
in the file 'stream' if you will, until closed by file.close()
-- Also, a misconception that does not need addressing is the
variable name 'file'. You do not need this name exactly, for all
you need is the variable name you are holding the file instance in.
varname.fileMethod(args)
file.write(version); file.close() -- Writing information of any kind
into a file and then closing it will guarantee
the successful save of your file.
Remember to always always ALWAYS close your file!