8.L. Text Libraries - JulTob/Ada GitHub Wiki

All the Standard I/O packages

  Ada.Text_IO
  Ada.Text_IO.Complex_IO 
  Ada.Text_IO.Text_Streams
  Ada.Wide_Text_IO
  Ada.Wide_Text_IO.Complex_IO
  Ada.Wide_Text_IO.Text_Streams
  Ada.Wide_Wide_Text_IO
  Ada.Wide_Wide_Text_IO.Complex_IO
  Ada.Wide_Wide_Text_IO.Text_Streams
  Ada.Stream_IO
  Ada.Sequential_IO
  Ada.Direct_IO

Usage

with Ada.Text_IO;
with Ada.Integer_Text_IO;

[...]

package T_IO renames Ada.Text_IO;
package I_IO renames Ada.Integer_Text_IO;

Alternatively: Image

with text_IO;
procedure PuttingOut is
   F: Float :=2.72;
   I: Integer := 2;
begin
   text_IO.Put(
      Float'Image(F) );
   text_IO.Put(
      Integer'Image(I));
end PuttingOut;
 

La librería Ada.Text_IO ofrece tipos, constantes y operaciones para realizar entrada y salida de datos con ficheros de texto y con la terminal estándar.La terminal estándar se maneja a través de dos ficheros "virtuales": Standard_Input (asociado generalmente con el teclado) y Standard_Output (Asociado generalmente con la pantalla).

Se puede simular la entrada y salida de cualquiera de los tipos mencionados arriba utilizando los atributos Image y Value para realizar conversiones a/desde String y aplicar las operaciones de entrada y salida de ristras de tamaño fijo.

with Text_IO; use Text_IO;
procedure Prueba is
   S : String (1 .. Integer'[Width](http://www.gedlc.ulpgc.es/docencia/NGA/Ada2005/ada/general/atributos_generales_escalares.html));
   LS: Natural;
   I : Integer;
begin
...
   Put_Line (Integer'[Image](http://www.gedlc.ulpgc.es/docencia/NGA/Ada2005/ada/general/atributos_generales_escalares.html) (I));
   Get_Line (S, LS);
   I := Integer'Value (S (1 .. LS));
...