comp.lang.ada
 help / color / mirror / Atom feed
* Re: Help with gnat IO
@ 1994-11-29 17:52 Bennett, Chip (KTR) ~U
  0 siblings, 0 replies; 6+ messages in thread
From: Bennett, Chip (KTR) ~U @ 1994-11-29 17:52 UTC (permalink / 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              *
*****************************************************************



^ permalink raw reply	[flat|nested] 6+ messages in thread
* Help with gnat IO
@ 1994-11-28 11:28 Woodrow Yeung
  1994-11-28 18:13 ` Tom Griest
  1994-11-29 22:05 ` Robert Dewar
  0 siblings, 2 replies; 6+ messages in thread
From: Woodrow Yeung @ 1994-11-28 11:28 UTC (permalink / raw)


Hi,

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.

Secondly, in the Ada reference manual (July 1980) there is a function  
GET_STRING that reads a sequence of character up to the next white space.   
This function does not exist in the gnat implementation.  I want to do  
this without writing my own routine.  By using GET, I end up with  
characters filling my string.  Worse yet, I read too much data.  My data  
is composed of lines with fields delimited by whitespace.  (I guess  
GET_STRING got taken out of Ada before it was finalized.)

I would appreciate any help.  By the way, where's all the traffic in
this newsgroup?  Are people still using Ada?

--
Woodrow Yeung
yeung@reed.edu



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

end of thread, other threads:[~1994-12-01 13:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-11-29 17:52 Help with gnat IO Bennett, Chip (KTR) ~U
  -- strict thread matches above, loose matches on Subject: below --
1994-11-28 11:28 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

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