General discussion

Locked

Printing a Turbo Pascal Program Output

By doar_me ·
I'd like to know how to print the output of a Borland Turbo Pascal program.
If I use Print Screen button (in DOS), it only prints a few lined in each page, if i try using "file.exe >prn" command, it prints only the output (without the niput the user puts).

Thank you,
Moshe.

This conversation is currently closed to new comments.

9 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Printing a Turbo Pascal Program Output

by mark.tassin In reply to Printing a Turbo Pascal P ...

Do you have the source code available? if so, write code to open a file to the printer (local printer is just open LPT1: for append, remote printer I'd use a port map first then open up LPT1:).

Else you can run it in a window, use ALT-PRINTSCRN together and print the captured image.

Collapse -

Printing a Turbo Pascal Program Output

by doar_me In reply to Printing a Turbo Pascal P ...

The question was auto-closed by TechRepublic

Collapse -

Printing a Turbo Pascal Program Output

by shadowtraitor In reply to Printing a Turbo Pascal P ...

Turbo Pascal Goes way back man, let's take the journey.
I am assuming you have code which you could modify, if not get screen grabs Alt-PrintScreen.
First send you output to a text file,format it the way you want. Read a line from the text file and send it to the printer using the following code.

{pass the text file with your data or make it global}
Procedure PrintOuput(var infile:text);
{string to read a line of data from file
put uses Strings, in you uses clause at the top of code};
var line:string;
begin
{reset the data file for reading}
reset(infile);
{get access to the printer using name
Lst }
assign(Lst,'LPT1');
{prepare printer for writing}
rewrite(Lst);
{read to the end of the file with data}
while not EOF(infile)do
begin
{read line from file}
readln(infile,line);
{send line to printer}
writeln(Lst,line);
end;
{send form feed character to the printer}

Collapse -

Printing a Turbo Pascal Program Output

by doar_me In reply to Printing a Turbo Pascal P ...

The question was auto-closed by TechRepublic

Collapse -

Printing a Turbo Pascal Program Output

by Denis A. Bilas In reply to Printing a Turbo Pascal P ...

Use file.exe >prn, but substitute each read()/readln() call in your program with my_read() and my_readln() procedures that call read/readln with the same arguments and then echo user input to the terminal.

Collapse -

Printing a Turbo Pascal Program Output

by doar_me In reply to Printing a Turbo Pascal P ...

The question was auto-closed by TechRepublic

Collapse -

Printing a Turbo Pascal Program Output

by Sigley, Phil In reply to Printing a Turbo Pascal P ...

When i print a screen form turbo pascal i use this method :

Create a global variable/file named printer, (the type of which is text).
Assign this file as the port to which your printer is connected
eg
assign(printer,'lpt1');
Throughout yourprogram when you want to print just send the display to the printer text file
eg writeln(printer,'text',variable');
The text in the speech marks and the variable will now be printed as opposed to being written to a file.
If anyone wants a sample of this routine please mail me at phatrat_uk@secureroot.com
Thanx

Collapse -

Printing a Turbo Pascal Program Output

by doar_me In reply to Printing a Turbo Pascal P ...

The question was auto-closed by TechRepublic

Collapse -

Printing a Turbo Pascal Program Output

by doar_me In reply to Printing a Turbo Pascal P ...

This question was auto closed due to inactivity

Back to Web Development Forum
9 total posts (Page 1 of 1)  

Related Discussions

Related Forums