[comp.sys.mac.programmer] Turbo Pascal question

bowden@gumby.cc.wmich.edu (Michael L. Bowden) (11/22/88)

How does one go about using "printer" from the PasPrinter
unit?  Once I USE the Unit, it supposedly sets up the filepointer
"printer", and I can write to it (to a LaserWriter IINT) via
standard write and writeln calls.  This all works fine *if* I
do a close(printer).  The problem is that I have multiple pages
(and/or files) that I want to print, and if I don't close the
printer, nothing comes out, and if I do, I can't use it again because
I get an I/O error telling me that the device isn't open.  Ditto
if I try a reset or rewrite on the device.
 
What I'm after is a generic procedure to print an entire file,
similar to the following:

Procedure Print(Var filename:string);

Var line: string;

Begin
   if exists(filename) then Begin
      Reset(fileptr,filename);
      Reset(printer);

      while not eof(fileptr) do Begin
         readln(fileptr,line);
         writeln(printer,line);
      end;
      page(printer);
      close(fileptr);
      close(printer);
      end
   else writeln('Cannot find file "',filename,'"');
End;

I'm primarily an IBM PC programmer, so I'm pretty ignorant
of things like system calls, and I don't have a 68000 instruction
reference card, so I can't exactly do inline code.  What do I need
to do to make this work on the Mac?  On the PC, all I had to do
was EXEC('C:\directory','PRINT.COM '+filename).

Any help would be appreciated.
--
Michael L. Bowden               Internet:  bowden@gumby.cc.wmich.edu
Western Michigan University                bowden@gw.wmich.edu
Academic Computer Center        Voice:     (616) 387-5448
Kalamazoo, MI  49008