comp.lang.ada
 help / color / mirror / Atom feed
* Catching a DEVICE_ERROR?
@ 2003-06-11 13:31 Tony Danezis
  2003-06-11 13:49 ` David C. Hoos
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Danezis @ 2003-06-11 13:31 UTC (permalink / raw)


Hello..

I am looking for assistance on how to catch a DEVICE_ERROR when
printing to LPT1. My Code seems to be correct and I print fine when
the printer (HP laserjet 1200)is ON, but the exception is not raised
when the printer is unplugged or not powered on.
(Using win 2000 and The GNAT Integrated Environment version 3.14a1)

thanks for any insight and assistance
Snippet of code follows:

with ADA.IO_EXCEPTIONS; use ADA.IO_EXCEPTIONS;
with TERMINAL;          use TERMINAL;
with Ada.Text_IO;       use Ada.Text_IO;

procedure Printer_Test is
  use Text;
  PrFile : TEXT.File_Type;

begin
  Create (File => PrFile, Mode => Out_File, Name => "LPT1:");
  Put_Line (File => PrFile, Item => "Here is a line for the printer");
  New_Page (File => PrFile);
  Close (File => PrFile);

  Put_Line("DONE CODE");

   exception
      when Text.Status_Error =>
        Text.Put_Line("Status_Error");

      when Text.Mode_Error   =>
        Text.Put_Line("Mode_Error");
  
      when Text.Device_Error =>
        Text.Put_Line("Device_Error");

      when others =>
        Text.Put_Line("Unknown_Error");

end Printer_Test;



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-06-12 10:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-11 13:31 Catching a DEVICE_ERROR? Tony Danezis
2003-06-11 13:49 ` David C. Hoos
2003-06-12 10:47   ` Tony Danezis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox