GNAT.IO Example


-- GNAT.IO Example
--
-- GNAT.IO offers:
--    A simple preelaborable subset of Text_IO capabilities

with Gnat.IO; use Gnat.IO;

procedure Gio is
   Test_Integer       : Integer;
   Test_String        : String (1 .. 255);
   Test_String_Length : Natural;
   Test_Character     : Character;
begin

   Put_Line("Type an Integer");
   Get(Test_Integer);

   -- Used to clean off the new line from the buffer
   -- after pushing enter on the last get since
   -- a get only removes the what it is looking for and
   -- leaves everything else in the input buffer.
   Get(Test_Character);

   Put("You typed : ");
   Put(Test_Integer);
   New_Line;

   Put_Line("What is your name?");
   Get_Line(Test_String,
            Test_String_Length);

   Put_Line("Hello, " & Test_String(1 .. Test_String_Length)& "!");
   Put_Line("Press <ENTER> when done.");
   Get(Test_Character);
   Put(Test_Character);

end Gio;

Contributed by: David Botton
Contributed on: May 18, 1999
License: Public Domain

Back