comp.lang.ada
 help / color / mirror / Atom feed
* Output to Printer Problems
@ 2002-06-09 14:39 Pheet
  2002-06-09 18:38 ` Jeffrey Carter
  0 siblings, 1 reply; 4+ messages in thread
From: Pheet @ 2002-06-09 14:39 UTC (permalink / raw)


Hiya,

I am having problems printing with ada. I'm using GNAT 3.13p
(GCC 2.8.1) on a Win98 box (yes, I know, don't ask).

I'm trying code along these lines:

with Text_IO;
use Text_io;

...

Procedure Print is
File:FIle_Type;
Begin
	open (File, Out_Mode, "LPT1");
	put(File, "Hello Printer!");
	close(File);
...
end print;

My printer is definitely called LPT1 'cause it's there in the hardware
profile and i can do:
>type test.txt > LPT1 
from the dos prompt and this works as expected.

The error I get is always ADA.IO_EXCEPTIONS.STATUS_ERROR , not a name
error.

Any ideas or suggestions on this would be greatfully appreciated, as
it's starting to irritate me now! :-)

TIA,

Pheet



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

* Output to Printer Problems
@ 2002-06-09 15:29 Pheet
  2002-06-09 19:31 ` David C. Hoos, Sr.
  0 siblings, 1 reply; 4+ messages in thread
From: Pheet @ 2002-06-09 15:29 UTC (permalink / raw)


Hiya,

I am having problems printing with ada. I'm using GNAT 3.13p
(GCC 2.8.1) on a Win98 box (yes, I know, don't ask).

I'm trying code along these lines:

with Text_IO;
use Text_io;

...

Procedure Print is
File:FIle_Type;
Begin
        open (File, Out_Mode, "LPT1");
        put(File, "Hello Printer!");
        close(File);
...
end print;

My printer is definitely called LPT1 'cause it's there in the
hardware
profile and i can do:
>type test.txt > LPT1 
from the dos prompt and this works as expected.

The error I get is always ADA.IO_EXCEPTIONS.STATUS_ERROR , not a
name
error.

Any ideas or suggestions on this would be greatfully appreciated, as
it's starting to irritate me now! :-)

TIA,

Pheet



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

* Re: Output to Printer Problems
  2002-06-09 14:39 Pheet
@ 2002-06-09 18:38 ` Jeffrey Carter
  0 siblings, 0 replies; 4+ messages in thread
From: Jeffrey Carter @ 2002-06-09 18:38 UTC (permalink / raw)


Pheet wrote:
> 
> Procedure Print is
> File:FIle_Type;
> Begin
>         open (File, Out_Mode, "LPT1");
>         put(File, "Hello Printer!");
>         close(File);
> ...
> end print;

I have successfully printed from Ada (GNAT) under Win98 by using Create,
rather than Open.

> 
> Any ideas or suggestions on this would be greatfully appreciated, as
> it's starting to irritate me now! :-)

One suggestion would be that you only post your message once.

-- 
Jeff Carter
"I unclog my nose towards you."
Monty Python & the Holy Grail



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

* Re: Output to Printer Problems
  2002-06-09 15:29 Output to Printer Problems Pheet
@ 2002-06-09 19:31 ` David C. Hoos, Sr.
  0 siblings, 0 replies; 4+ messages in thread
From: David C. Hoos, Sr. @ 2002-06-09 19:31 UTC (permalink / raw)



----- Original Message ----- 
From: "Pheet" <a.pheet@NOTINNEDMEATntlworld.com>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada.eu.org>
Sent: June 09, 2002 10:29 AM
Subject: Output to Printer Problems


> Hiya,
> 
> I am having problems printing with ada. I'm using GNAT 3.13p
> (GCC 2.8.1) on a Win98 box (yes, I know, don't ask).
> 
> I'm trying code along these lines:
> 
> with Text_IO;
> use Text_io;
> 
> ...
> 
> Procedure Print is
> File:FIle_Type;
> Begin
>         open (File, Out_Mode, "LPT1");
>         put(File, "Hello Printer!");
>         close(File);
> ...
> end print;
>
Three problems I can see with your program, viz.:

  1. There is no file mode in Text_IO called "Out_Mode";
     Perhaps you meant "Out_File."

  2. An file of mode Out_File cannot be opened -- it can
     only be created.  Only files of In_File, and Append_File
     modes can be opened, and printers generally don't accept
     being opened in Append_File mode.

  3. You probably will need to add a line "New_Page (File);"
     in order to get the printer to eject the page.


   





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

end of thread, other threads:[~2002-06-09 19:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-09 15:29 Output to Printer Problems Pheet
2002-06-09 19:31 ` David C. Hoos, Sr.
  -- strict thread matches above, loose matches on Subject: below --
2002-06-09 14:39 Pheet
2002-06-09 18:38 ` Jeffrey Carter

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