Printing+the+output+from+a+program

//by Richard Russell, June 2007//

On the old BBC Microcomputer, if you wanted to create a hardcopy record of the output from a program (which normally displays its results only on the screen) you could easily do that simply by pressing **Ctrl/B** before running the program. Since **Ctrl/B** corresponds to [|VDU 2] it had the effect of copying all subsequent screen output also to the printer. Obviously this would only produce a sensible printout for plain (scrolling) text, not graphics or characters positioned using TAB(X,Y).

Since this was a convenient way of making a quick hardcopy record of a program's output it would be nice to be able to do the same in //BBC BASIC for Windows//, and you can! The trick is not to run the program in the normal way (clicking the Run button in the toolbar, or using the Run menu selection) but instead to enter **Immediate Mode** first. You can do that by clicking on the 'keyboard' button in the toolbar or using the Run... Immediate Mode menu selection.

Once in immediate mode you can use exactly the same method as you would have done on the BBC Micro: press **Ctrl/B** (hold down Ctrl, press B, release Ctrl) then type **RUN** followed by Return (Enter). The program will be run and any output will be sent to both the screen and the printer (assuming there are no commands in the program to disable the printer).

One difference from the BBC Micro is that you're likely to have to force the printer to 'eject' the sheet once the program has finished running. You can do that either by closing the program's output window or by sending a VDU 12 (most easily achieved by pressing **Ctrl/L** in the immediate mode window). If you want to disable subsequent output to the printer you can do that using **Ctrl/C** (VDU 3). To combine the two hold down Ctrl, press L then C, release Ctrl.

An alternative method for creating a hardcopy record of a program's output is to copy its output window to the clipboard (as text using **Ctrl/Tab** or as graphics using **Alt/PrntScrn**) and to print the clipboard contents (e.g. using Notepad for text or Paint for graphics), however this isn't suitable if you want to print text whch has scrolled off the top of the window. You can, of course, also modify the program itself to include a hardcopy output capability.