on Aug 28th, 2012, 03:39am, fisherhj wrote:I have written a small ephemeris program -- it generates planetary positions for various dates. Can I print the output to a text file instead of generating hard copy on my printer? |
|
Certainly you can if the output is 'plain text'. The easiest way is probably to output to a file as well as to the screen, using *SPOOL:
Code: *SPOOL outputfile.txt
PRINT "Output your data in the normal way"
*SPOOL
If you want to output to a file instead of to the screen there are various approaches such as using *SPOOL in conjunction with VDU 21 and VDU 6:
Code: VDU 21
*SPOOL c:\outputfile.txt
PRINT "Output your data in the normal way"
*SPOOL
VDU 6
Or you could use PRINT# instead of PRINT:
Code: outfile% = OPENOUT("outputfile.txt")
PRINT #outfile%, "Output your data directly to a file"
BPUT #outfile%, 10
CLOSE #outfile%
Or you could use *OUTPUT to redirect the output:
Code: outfile% = OPENOUT("outputfile.txt")
OSCLI "OUTPUT " + STR$outfile%
PRINT "Output your data in the normal way"
*OUTPUT
CLOSE #outfile%
Richard.