File input/output is part of Short Circuit's Console Program Basics selection.
Task

Create a file called   "output.txt",   and place in it the contents of the file   "input.txt",   via an intermediate variable.

In other words, your program will demonstrate:

   how to read from a file into a variable
   how to write a variable's contents into a file


Oneliners that skip the intermediate variable are of secondary interest — operating systems have copy commands for that.




----------------------------------------
-- Returns file as ByteArray
-- @param {string} tFile
-- @return {byteArray|false}
----------------------------------------
on getBytes (tFile)
  fp = xtra("fileIO").new()
  fp.openFile(tFile, 1)
  if fp.status() then return false
  data = fp.readByteArray(fp.getLength())
  fp.closeFile()
  return data
end
 
----------------------------------------
-- Saves ByteArray to file
-- @param {string} tFile
-- @param {byteArray} tString
-- @return {bool} success
----------------------------------------
on putBytes (tFile, tByteArray)
  fp = xtra("fileIO").new()
  fp.openFile(tFile, 2)
  err = fp.status()
  if not (err) then fp.delete()
  else if (err and not (err = -37)) then return false
  fp.createFile(tFile)
  if fp.status() then return false
  fp.openFile(tFile, 2)
  if fp.status() then return false
  fp.writeByteArray(tByteArray)
  fp.closeFile()
  return true
end