I use the following to save screen output to a file
writefile("file.txt"),
tex(expression),
closefile()
The above sends the output of the tex() to the file automatically. which is all and well and what I want. (side-point: It also sends an annoying NIL line each time to the file, which I had to parse put later).
Now, when running the above code again, the file is appended to, which is not what I want. I want to either overwrite the file each time, or if there is a way to delete the file, so I can call delete on it before.
I looked at help and not able to find a command to delete a file, and I also see no option to tell writefile() to overwrite the file?
Is there an option or way around this? I am on windows 7, Maxima version: 5.36.1 Lisp: SBCL 1.2.7
I guess you are trying to capture the output of
texinto a file. If so, here are a couple of other ways to do it:where
destinationis either a file name (which is appended) or a stream, as created byopenaoropenwand closed byclose. By the way,destinationcould befalse, in which casetexreturns a string.where again
destinationis either a file name (which is appended or clobbered, as determined by the global flagfile_output_append) or a stream.with_stdoutcould be useful if you want to mix in some output not generated bytex, e.g.,print("% some commentary");.