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.




declare
  class TextFile from Open.file Open.text end
 
  In = {New TextFile init(name:"input.txt")}
  Out = {New TextFile init(name:"output.txt" flags:[write text create truncate])}
 
  proc {CopyAll In Out}
     case {In getS($)} of false then skip
     [] Line then
        {Out putS(Line)}
        {CopyAll In Out}
     end
  end
in
  {CopyAll In Out}
  {Out close}
  {In close}