How can I Print Output in Turbo Pascal for Windows v. 1.5? 
Author Message
 How can I Print Output in Turbo Pascal for Windows v. 1.5?

I made an honest effort at finding the answer to this question in the FAQ, hope
you can help.

I am teaching a course, using Turbo Pascal for students who have never done any
programming before. We are writing "console" programs, and working in a Windows
NT environment.    It seems that in TP for Windows, v. 1.5, that to get any
output to the screen, we merely (and must)  include the statement:

 Uses WinCrt;

near the top of the program.  However, it does not seem that we can print the
output appearing in this window.  Does anyone know of a relatively simple way
to make the output "printable"?

Thank you for any suggestions.  If you could respond  to me at



Wed, 18 Jun 1902 08:00:00 GMT  
 How can I Print Output in Turbo Pascal for Windows v. 1.5?

from Turbo Pascal for Windows 1.5:

I'm sure I've answered this question monthly for the last year!
We need to put it in the FAQ.  (TPW seems to be different from TP.)

In TPW, just open the printer as a text file and write to it:

Var Printer:Text;
Begin
  Assign(Printer,'LPT1:'); {or LPT2: or LPT3: if you have them!}
  Rewrite(Printer);
  WriteLn(Printer,'This will be printed.');
  Close(Printer);
end.

If you want the same code to printer either to the screen or to
the printer, a text file can be assigned to the screen with AssignCRT:

Var Output:Text;
Begin
  Write('Screen or Printer output (S/P): ');
  If UpCase(ReadKey)='S'
    Then AssignCRT(Output)
    Else Assign(Output,'LPT1:');
  Rewrite(Output);
  WriteLn(Output,'This will appear either on screen or printer.');
  Close(Output);
end.

If you want screen output echoed to the printer you could override
the WriteLn command, but that is a pain.  Probably better to modify
the WinCRT unit to echo to the printer.  The souce code for the
WinCRT unit is included with TPW1.5 (but it is NOT a great example
of good style).  I rewrite it before letting my students see it.
 _
|/|\/|                          ||   Maths & Computer Science

                                            (Canada)



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Printing the output in Turbo Pascal for Windows 1.5

2. How can I Print Output in Turbo Pascal for Windows v. 1.5?

3. printing to printer in turbo pascal 1.5

4. Why Turbo Pascal for Windows 1.5 ?

5. Turbo Pascal for Windows 1.5 Tutorial

6. Questions: CRT of Turbo Pascal for Windows 1.5

7. Turbo Pascal for Windows 1.5

8. Turbo Pascal for Windows 1.5

9. Turbo Pascal for Windows 1.5

10. Turbo Pascal for Windows 1.5

11. Turbo Pascal for Windows 1.5 - CRT unit

12. REQ: Turbo Pascal for Windows 1.5 HELP!

 

 
Powered by phpBB® Forum Software