comp.lang.ada
 help / color / mirror / Atom feed
From: "Bennett, Chip (KTR) ~U" <BennettC@J64.STRATCOM.AF.MIL>
Subject: Re: Help with gnat IO
Date: Tue, 29 Nov 1994 09:52:00 PST
Date: 1994-11-29T09:52:00-08:00	[thread overview]
Message-ID: <2EDB699A@SMTPGATE2.STRATCOM.AF.MIL> (raw)

Woodrow Yeung <yeung@BAGPIPE.REED.EDU> wrote:

> I'm using gnat and am having trouble with the input/output routines.
> First of all, how do I use the INTEGER_IO package?  I get this error
> message:
> file "integer_io.ads" not found
> but I see the INTEGER_IO package defined within the a-textio.ads file.
> I want to be able to format my field width.

Remember that INTEGER_IO is a generic package within TEXT_IO.  You "with" in
TEXT_IO and then instantiate your own version of INTEGER_IO:

     with Text_IO; use Text_IO;
     procedure WhoCares is

        type ItemCount is range 0 .. 100;

        package ItemCount_IO is new Integer_IO (ItemCount);
        use ItemCount_IO;

        MyCount : ItemCount := 10;

        package Int_IO is new Integer_IO (Integer);
        use Int_IO;

        Count : Integer := 348;

     begin

        Put (MyCount); -- implicitly uses ItemCount_IO.Put;
        Put (Count); -- implicitly uses Int_IO.Put;

     end WhoCares;

INTEGER_IO is a generic package _because_ there can be many user defined
integer types.  If you already knew all this, it was good practice for me to
tell it anyway.  :-)

*****************************************************************
* Chip Bennett, GDE Systems Inc | BennettC@j64.stratcom.af.mil  *
* USSTRATCOM/J64213             | Voice (402)294-7360           *
* 901 SAC Blvd, Suite 2B24      | FAX   (402)294-7912           *
* Offutt AFB, NE 68113-6600     | Proud member of Team Ada      *
* Opinions expressed here are my own _so_,  TTFWTW              *
*****************************************************************



             reply	other threads:[~1994-11-29 17:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-11-29 17:52 Bennett, Chip (KTR) ~U [this message]
  -- strict thread matches above, loose matches on Subject: below --
1994-11-28 11:28 Help with gnat IO Woodrow Yeung
1994-11-28 18:13 ` Tom Griest
1994-11-29 22:05 ` Robert Dewar
1994-12-01  3:10   ` Keith Thompson
1994-12-01 13:34   ` Bob Duff
replies disabled

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