comp.lang.ada
 help / color / mirror / Atom feed
* Print
@ 1995-03-16  4:49 Scott Malcolm Smedley
  1995-03-16  5:49 ` Print Dale Stanbrough
  1995-03-17  6:06 ` Print MenTaT - !Productions
  0 siblings, 2 replies; 3+ messages in thread
From: Scott Malcolm Smedley @ 1995-03-16  4:49 UTC (permalink / raw)


How can I "print" an array of integers/characters/strings etc
in ADA?? I mean "print" as in Printer.

For example, let's say I had an array(1..10) of integers.
How could I print each integer one underneath the other on
a printer?

I'm not 2 sure whether it matters or not, but I am using ADA on
a DOS machine, not UNIX.

Thanks 4 any help U can give...

Scott

s9406160@yallara.cs.rmit.edu.au



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

* Re: Print
  1995-03-16  4:49 Print Scott Malcolm Smedley
@ 1995-03-16  5:49 ` Dale Stanbrough
  1995-03-17  6:06 ` Print MenTaT - !Productions
  1 sibling, 0 replies; 3+ messages in thread
From: Dale Stanbrough @ 1995-03-16  5:49 UTC (permalink / raw)


Subject: Print
From: Scott Malcolm Smedley, s9406160@yallara.cs.rmit.edu.au
Date: 16 Mar 1995 04:49:50 GMT
In article <3k8g1e$8ri@goanna.cs.rmit.edu.au> Scott Malcolm Smedley,
s9406160@yallara.cs.rmit.edu.au writes:
>How can I "print" an array of integers/characters/strings etc
>in ADA?? I mean "print" as in Printer.
>
>For example, let's say I had an array(1..10) of integers.
>How could I print each integer one underneath the other on
>a printer?
>
>I'm not 2 sure whether it matters or not, but I am using ADA on
>a DOS machine, not UNIX.
>
>Thanks 4 any help U can give...
>
>Scott
>
>s9406160@yallara.cs.rmit.edu.au


The Meridian Ada compiler manual has the following information...

-----start-quote--------------------------
Special file names
Note that there are special file names that refer to
non-disk devices

CON\x7f - the console
AUX - serial port1
...
LPT1 - parallel port 1
PRN - same as LPT1
...

To open one of the special file names for output, use
create with mode out_file as in the following example.

with text_io;	use text_io;
procedure printer_demo is
	f:file_type;
	printer:constant string := "PRN";
begin
	create(file => f, name => printer);
	put_line(f, "this is a test");
	new_page(f);
	close(f);
end printer_demo;
-------------------------------------------

Your mileage may vary depending upon what networks you are
attached to.



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

* Re: Print
  1995-03-16  4:49 Print Scott Malcolm Smedley
  1995-03-16  5:49 ` Print Dale Stanbrough
@ 1995-03-17  6:06 ` MenTaT - !Productions
  1 sibling, 0 replies; 3+ messages in thread
From: MenTaT - !Productions @ 1995-03-17  6:06 UTC (permalink / raw)


s9406160@yallara.cs.rmit.edu.au (Scott Malcolm Smedley) writes:

>How can I "print" an array of integers/characters/strings etc
>in ADA?? I mean "print" as in Printer.

>For example, let's say I had an array(1..10) of integers.
>How could I print each integer one underneath the other on
>a printer?

>I'm not 2 sure whether it matters or not, but I am using ADA on
>a DOS machine, not UNIX.

Open the printer as a sequential file...  (There's probably a better way
of doing it, but this works.)

with SEQUENTIAL_IO;
procedure FOO is

  package LPT_FLOAT_IO is new SEQUENTIAL_IO(FLOAT);  -- You need one of these
  use     LPT_FLOAT_IO;                              -- for each type you use.

  PRINTER: FILE_TYPE;
  STUFF: array(1 .. 10) of FLOAT;
  PRINTER_DEVICE: STRING(1 .. 20);

begin -- FOO

  PRINTER_DEVICE:="lpt1";               -- DOS uses LPTx, UNIX uses /dev/lptx.
  OPEN(PRINTER, OUT_FILE, PRINTER_DEVICE);

  -- Fill your array.

  WRITE(PRINTER, STUFF(1));

end FOO;

--
GCS -d+ H+ s++:- g+ p? !au a- w+++            !Productions 1995
v* C+++ UB+++A++++ P++ L++ E+ N+++         Note new email address!   
K+ !W--- M-- V po- Y+ t++ 5+ jx G?
R tv++ D- B--- e+ u** h f r++ !n y+ "No matter where you go, there you are."




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

end of thread, other threads:[~1995-03-17  6:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-03-16  4:49 Print Scott Malcolm Smedley
1995-03-16  5:49 ` Print Dale Stanbrough
1995-03-17  6:06 ` Print MenTaT - !Productions

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