* Ada95 input output - simple question from novice
@ 1996-03-25 0:00 Tiffany Rose Winn
1996-03-24 0:00 ` Robert Dewar
1996-03-25 0:00 ` Tore Joergensen
0 siblings, 2 replies; 4+ messages in thread
From: Tiffany Rose Winn @ 1996-03-25 0:00 UTC (permalink / raw)
I want to use a simple put statement to display an integer in
a minimum number of spaces: for example,
count: integer:= 5;
put(count, 2);
I thought the above statement would display the integer variable
count in a minimum of two spaces, but I keep getting an error saying
that my second put parameter is invalid.
My guess is that this may be because the Ada compiler is using the
put for characters, so I tried adding the line
package Ada.Integer_Text_IO is new Ada.Text_IO.Integer_IO(Integer);
just after the declaration of my main procedure, and also changed
the relevant put statement to
Ada.Integer_Text_IO.put(count, 2);
This gave me the following error:
child unit allowed only at library level
I'm stuck as to where to go next (moving the package declaration to just
below the "with Text_IO" line gave me errors, too).
Can anyone help?
Thanks in advance for your time.
--
Tiffany
winn@cs.flinders.edu.au
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Ada95 input output - simple question from novice
1996-03-25 0:00 Ada95 input output - simple question from novice Tiffany Rose Winn
@ 1996-03-24 0:00 ` Robert Dewar
1996-03-25 0:00 ` Keith Thompson
1996-03-25 0:00 ` Tore Joergensen
1 sibling, 1 reply; 4+ messages in thread
From: Robert Dewar @ 1996-03-24 0:00 UTC (permalink / raw)
Forget about trying to instantiate integer_io until you understand
generics better. Meanwhile (since you are clearly using an Ada 95
compiler, probably GNAT), use:
with Integer_Text_IO; use Integer_Text_IO;
now your original put will work fine, because Integer_Text_IO provides
a put for type Integer.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Ada95 input output - simple question from novice
1996-03-24 0:00 ` Robert Dewar
@ 1996-03-25 0:00 ` Keith Thompson
0 siblings, 0 replies; 4+ messages in thread
From: Keith Thompson @ 1996-03-25 0:00 UTC (permalink / raw)
In <dewar.827726620@schonberg> dewar@cs.nyu.edu (Robert Dewar) writes:
> Forget about trying to instantiate integer_io until you understand
> generics better. Meanwhile (since you are clearly using an Ada 95
> compiler, probably GNAT), use:
>
> with Integer_Text_IO; use Integer_Text_IO;
>
> now your original put will work fine, because Integer_Text_IO provides
> a put for type Integer.
Correction: that should be
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
--
Keith Thompson (The_Other_Keith) kst@thomsoft.com
TeleSoft^H^H^H^H^H^H^H^H Alsys^H^H^H^H^H Thomson Software Products
10251 Vista Sorrento Parkway, Suite 300, San Diego, CA, USA, 92121-2718
This sig uses the word "Exon" in violation of the Communications Decency Act.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Ada95 input output - simple question from novice
1996-03-25 0:00 Ada95 input output - simple question from novice Tiffany Rose Winn
1996-03-24 0:00 ` Robert Dewar
@ 1996-03-25 0:00 ` Tore Joergensen
1 sibling, 0 replies; 4+ messages in thread
From: Tore Joergensen @ 1996-03-25 0:00 UTC (permalink / raw)
Tiffany Rose Winn (winn@ist.flinders.edu.au) wrote:
: My guess is that this may be because the Ada compiler is using the
: put for characters, so I tried adding the line
: package Ada.Integer_Text_IO is new Ada.Text_IO.Integer_IO(Integer);
: just after the declaration of my main procedure, and also changed
: the relevant put statement to
: Ada.Integer_Text_IO.put(count, 2);
Just drop the 'Ada.' in the new package name:
package integer_text_io is new ada.text_io.integer_io(integer);
--
+-------------------------+-------------------------------------------+
| Tore B. Joergensen | e-mail : tore@lis.pitt.edu |
| Centre Court Villa | web : http://www.pitt.edu/~tojst1 |
| 5535 Centre Avenue # 6 | |
| Pgh, PA 15232, USA | Norwegian MSIS-student at Univ. of Pgh. |
+-------------------------+-------------------------------------------+
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1996-03-25 0:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-03-25 0:00 Ada95 input output - simple question from novice Tiffany Rose Winn
1996-03-24 0:00 ` Robert Dewar
1996-03-25 0:00 ` Keith Thompson
1996-03-25 0:00 ` Tore Joergensen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox