Previous topic | Ada Home Page | Index

I/O Libraries

Each distinct type needs its own I/O library.

General form:

    	package type_io is new TEXT_IO.basetype_io (typename);

Subtypes don't need separate I/O libraries, but the I/O libraries for the base types must be present.

Examples

    	package int_io is new TEXT_IO.INTEGER_IO (INTEGER);

      	type ages is new INTEGER range 0 .. 110;
    	package ages_io is new TEXT_IO.INTEGER_IO (ages);

	type measurement is digits 10;
    	package measurement_io is new TEXT_IO.FLOAT_IO (measurement);

	type suits is (clubs, diamonds, hearts, spades);
    	package suits_io is new TEXT_IO.ENUMERATION_IO (suits);

	type colours is (white, red, yellow, green, brown, blue, pink, black);
    	package colours_io is new TEXT_IO.ENUMERATION_IO (colours);


Previous topic | Ada Home Page | Index
c-lokan@adfa.oz.au / 21 Feb 96