Board index » delphi » Printing to LPT2 (LST)

Printing to LPT2 (LST)

Hi

I have a small problem with a program i'm writing for my computer
science class.

I am wanting to print to the printer useing the
WRITELN(lst,'what ever'); but my printer is conected to LPT2 port.

Is there any way that I can redirect the output to LPT2.

Thank you for your time.

Cheers
David Mackie (d_mac...@earthling.net)

South Africa

 

Re:Printing to LPT2 (LST)


Quote
>>Is there any way that I can redirect the output to LPT2.
>assign(lst,'lpt2');
>rewrite(lst);

>In fact the printer unit does nothing more than that (with lpt1)

The printer unit does more than that: switches the printer handling routines
into binary mode. Use the following code:

var lst: text;

begin
  assign(lst,'LPT2');
  rewrite(lst);
  { this asm routine switches to binary mode }
  asm
    MOV BX,WORD PTR lst {I/O handle}
    MOV AX,4400h
    INT 21h
    OR  DL,20h
    MOV DH,0
    MOV AX,4401h
    INT 21h
  end;
  {...}
end.

Regards,
-BandiT-

Re:Printing to LPT2 (LST)


I beleive you can go assign (myprinter, 'lpt2') where myprinter is of type
TEXT;
then go
writeln (myprinter, 'what ever');

Quote
David Mackie wrote in message <345E2B8D.7D53A...@earthling.net>...
>Hi

>I have a small problem with a program i'm writing for my computer
>science class.

>I am wanting to print to the printer useing the
>WRITELN(lst,'what ever'); but my printer is conected to LPT2 port.

>Is there any way that I can redirect the output to LPT2.

>Thank you for your time.

>Cheers
>David Mackie (d_mac...@earthling.net)

>South Africa

Re:Printing to LPT2 (LST)


David Mackie <d_mac...@earthling.net> wrote in article
<345E2B8D.7D53A...@earthling.net>...

Quote
> I am wanting to print to the printer useing the
> WRITELN(lst,'what ever'); but my printer is conected to LPT2 port.

> Is there any way that I can redirect the output to LPT2.

Please find attached, some source that will do what you require.  Please
also note that I do not use the Pascal unit, 'Printer' at all.

Let me know if you find this useful.

begin 600 Initlpt.pas
<encoded_portion_removed>
end

begin 600 Sample.pas
M4')O9W)A;2!386UP;&50<FEN=%1O3%!4,CL-"@T*57-E<PT*"4EN:71,<'0[
M#0H-"E9A<@T*"6D).B!">71E.PT*#0I"96=I;@T*"4EF($EN:710<FEN=&5R
M*"=,4%0R)RD@5&AE;@T*"4)E9VEN#0H)"49O<B!I(#H](#$@5&\@,C @1&\-
M"@D)"5=R:71E3&XH3'-T+" G5&5S="!L:6YE(&YO("<L(&DZ,BD[#0H-"@D)
M5W)I=&4H3'-T+"!#:'(H,3(I*3L-"@D)0VQO<V4H3'-T*3L-"@E%;F0[#0I%
%;F0N#0HH
`
end
end

Re:Printing to LPT2 (LST)


In article <01bceb4d$c6a2d2e0$LocalH...@lexlines.iafrica.com> of Fri, 7
Nov 1997 07:20:39 in comp.lang.pascal.borland, BASTARD

Quote
<lexli...@iafrica.com> wrote:
>begin 600 Initlpt.pas
>M56YI="!);FET3%!4.PT*#0I);G1E<F9A8V4-"@T*57-E<PT*"4-R=#L-"@T*
>M5F%R#0H)3'-T"0DZ(%1E>'0[#0H)1&5F875L=$Q05 DZ(%-T<FEN9SL-"@T*
> ...

What can one say to one who already describes him/her-self with a term
frequently considered descriptive of those who post encoded material to
text newsgroups?

Moreover, IMHO, anyone who commends code containing

        If ErrorCode = 0 Then
                InitPrinter := TRUE
        Else
                InitPrinter := FALSE;

is sadly deficient in appreciation of the finer points of the language.

--
John Stockton, Surrey, UK.    j...@merlyn.demon.co.uk    Turnpike v1.12    MIME.
  Web URL: http://www.merlyn.demon.co.uk/ - FAQqish topics, acronyms and links.
  Correct 4-line sig separator is as above, a line comprising "-- " (SoRFC1036)
  Before a reply, quote with ">" / "> ", known to good news readers (SoRFC1036)

Other Threads