Posted 24 June 2012 - 04:23 PM
When using fs.open("filename", "a") do you start writing at the end of the file? I am creating an e-mail server and this is my code so far…
Spoiler
function escape()
term.clear()
term.setCursorPos(1,1)
print("MENU:")
print("1. Send")
print("2. Discard & Quit")
print("3. Back")
print("Press 1, 2, or 3)
local event, esc = os.pullEvent("char")
if esc == 1 then
type = 2
send()
elseif esc == 2 then
type = 2
elseif esc == 3 then
type = 1
erm.clear()
term.setCursorPos(1,1)
print("Please Type Body")
print("To Exit Push Escape")
print(read.readAll())
read.close()
else
print("wrong key")
type = 1
term.clear()
term.setCursorPos(1,1)
print("Please Type Body")
print("To Exit Push Escape")
print(read.readAll())
read.close()
end
end
print("Please Type Body")
print("To Exit push Escape")
local read = fs.open("body". "r")
local append = fs.open("body", "a")
local write = fs.open("body", "w")
term.setCursorBlink(true)
local event, key = os.pullEvent("char")
if key == "escape" then
escape()
else
write.write(key)
write(key)
type = 1
if type == 1 then
local event, key = os.pullEvent("char")
if key == "escape" then
escape()
else
append.write(key)
write(key)
end
end