Pascal Printing

I was wondering how one could print the contents of a text file to the local LPT 1 printer thanks for your time i would really appreciate it if you could paste a brief example and tell me what include files i need to use... etc
spamanAsked:
Who is Participating?
 
washouttConnect With a Mentor Commented:
Okay, here's a sample program that does just that. Any questions please ask:

USES Printer; { So you can print from this program }

VAR TextFile : Text;
        InS      : String;

BEGIN
     Assign(TextFile,'FILE.TXT'); { The file you want to print }
    Reset(TextFile);

   WHILE NOT EOF(TextFile) DO
   BEGIN
      Readln(TextFile,Ins);
      Writeln(Lst,InS);         { Lst = Printer. InS = String to print. }
   END;                            { You CAN say "Writeln(Lst,'Hello There'); }

   Close(TextFile);
END.

does this answer it?
0
 
kazooie21Commented:
print it from notepad
0
 
spamanAuthor Commented:
Thanks for hte awsome reply =) it really helped clearify the poorly made help file =P
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
washouttCommented:
Glad I could help. Note that Lst is quite very much like your screen, in the sense that DOS sees them both as character output devices. The following statements are also acceptable:

var r : real;

begin
   r := 3.54;

  writeln(lst,'value is ',r:6:2);

<or>


writeln(lst,'a':6,'b':5);

Play around with it.
0
 
spamanAuthor Commented:
I was also wondering if there was a way to clear out the printer buffer because to get it to actually print i need to reset the printer each time .....
0
 
washouttCommented:
Reset the printer how?

PS What setup you have? What PC & Printer? Using this out of a DOS-shell or plain old ms-dos?
0
 
spamanAuthor Commented:
I have a p233 with an epson stylus 640 . i am running the pascal stuff out of a dos shell under windows
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.