comp.lang.ada
 help / color / mirror / Atom feed
From: mentat@alpha.acast.nova.edu (MenTaT - !Productions)
Subject: Re: Print
Date: Fri, 17 Mar 1995 06:06:05 GMT
Date: 1995-03-17T06:06:05+00:00	[thread overview]
Message-ID: <mentat.795420365@alpha> (raw)
In-Reply-To: 3k8g1e$8ri@goanna.cs.rmit.edu.au

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."




      parent reply	other threads:[~1995-03-17  6:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-16  4:49 Print Scott Malcolm Smedley
1995-03-16  5:49 ` Print Dale Stanbrough
1995-03-17  6:06 ` MenTaT - !Productions [this message]
replies disabled

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