File input/output: Difference between revisions

(added lua)
Line 793:
copy "input.txt "output.txt</lang>
=={{header|Lua}}==
<lang lua>in_filelocal input = io.open("input.txt", "r")
out_filelocal output = io.open("output.txt", "w")
 
if in_filenot ==output niland not input then
os.exit(1)
end
 
out_file = io.open("output.txt", "w")
 
if out_file == nil then
os.exit(1)
end
 
--read the whole file from in and write to out
out_fileoutput:write(in_fileinput:read("*a"))
 
in_fileinput:close()
out_fileoutput:close()
</lang>
 
=={{header|MAXScript}}==
<lang maxscript>inFile = openFile "input.txt"
Anonymous user