Level 2, lesson 13

# 2.13 Writing text-files

Writing text to a file is just as easy as writing text to screen. Open the file, redirect the output, and write like you would write to the screen:

         64 string filename
         " outfile.dat" filename copy

         output open                     \ open the file
         0= if                           \ error if not open
               ." File could not be opened" cr quit
         then

         output file                     \ write to file
         ." This is written to disk" cr

Just note that 'CR' will always write a linefeed, even when issued under a Microsoft Operating system.