BBC BASIC for Windows
« Can I print to a file? »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:13pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Can I print to a file?  (Read 702 times)
fisherhj
New Member
Image


member is offline

Avatar




PM


Posts: 2
xx Can I print to a file?
« Thread started on: Aug 28th, 2012, 03:39am »

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?

User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Can I print to a file?
« Reply #1 on: Aug 28th, 2012, 08:33am »

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.
User IP Logged

fisherhj
New Member
Image


member is offline

Avatar




PM


Posts: 2
xx Re: Can I print to a file?
« Reply #2 on: Aug 28th, 2012, 2:59pm »

Lovely! Many thanks
--Howard
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls