comp.lang.ada
 help / color / mirror / Atom feed
From: antonis01@in.gr (Tony Danezis)
Subject: Catching a DEVICE_ERROR?
Date: 11 Jun 2003 06:31:47 -0700
Date: 2003-06-11T13:31:48+00:00	[thread overview]
Message-ID: <5771e505.0306110531.2df2d93a@posting.google.com> (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;



             reply	other threads:[~2003-06-11 13:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-11 13:31 Tony Danezis [this message]
2003-06-11 13:49 ` Catching a DEVICE_ERROR? David C. Hoos
2003-06-12 10:47   ` Tony Danezis
replies disabled

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