up previous next
open output file
OpenOFile(S:STRING):DEVICE
OpenOFile(S:STRING,"w" or "W"):DEVICE
|
This function opens the file with name S---creating it if it
does not already exist---for output. If used with second argument
w or
W then it immediately erases the file S.
The function
Print On
is then used for appending output to S.
D := OpenOFile("my-test"); -- open "my-test" for output from CoCoA
Print "hello world" On D; -- print string into "mytest"
Print " test" On D; -- append to the file "mytest"
Close(D); -- close the file
D := OpenOFile("my-test","w"); -- clear "my-test"
Print "goodbye" On D; -- "mytest" now consists only of the string "goodbye"
Close(D);
|