5 posts
Posted 07 November 2012 - 06:12 AM
Hi, I was wondering if i could make a program that could edit files within itself, and save those files. like.. microsoft word type thing, You could make a file, type some words, save the files, and view them later. How could i do that?
351 posts
Posted 07 November 2012 - 06:15 AM
How would this be different from edit?
514 posts
Location
Over there
Posted 07 November 2012 - 06:19 AM
copy rom/programs/edit to somewhere else and edit it.
463 posts
Location
Germany
Posted 07 November 2012 - 07:24 AM
Look in the wiki for the fs API.
5 posts
Posted 07 November 2012 - 08:12 AM
How would this be different from edit?
I suppose it wouldn't be…
194 posts
Location
Spain
Posted 07 November 2012 - 10:16 AM
Just do something like:
--Write a file
hWrite = fs.open("fileName","w")
text = io.read()
hWrite.write(text)
hWrite.close() --This line is very important
-Read a file
hRead = fs.open("fileName","r")
text = hWrite.readLine()
hWrite.close() --It won't work if you don't close the file.
print(text)
This is the basic concept. If you want to know more, check the fs API in the wiki.
5 posts
Posted 07 November 2012 - 01:34 PM
Just do something like:
--Write a file
hWrite = fs.open("fileName","w")
text = io.read()
hWrite.write(text)
hWrite.close() --This line is very important
-Read a file
hRead = fs.open("fileName","r")
text = hWrite.readLine()
hWrite.close() --It won't work if you don't close the file.
print(text)
This is the basic concept. If you want to know more, check the fs API in the wiki.
Alright, Thanks!