up previous next
***** NOT YET UPDATED TO CoCoA-5: follow with care *****
To print CoCoA output to a file, one first opens the file
then prints to the file using
To receive verbatim input from a file, one first opens the file with
, then reads lines from the file with
/**/ D := OpenOFile("my-file"); -- open text file with name "my-file",
/**/ -- creating it if necessary
/**/ Print "hello world" On D; -- append "hello world" to my-file
/**/ Close(D); -- close the file
/**/ D := OpenIFile("my-file"); -- open "my-file"
To read and execute a sequence of CoCoA commands from a text file, one
command. For instance, if the
contains a list of CoCoA commands, then
reads and executes the commands.