comp.lang.ada
 help / color / mirror / Atom feed
From: mockturtle <framefritti@gmail.com>
Subject: Re: Ada equivalent of c++ strstream
Date: Sat, 12 Sep 2009 04:27:05 -0700 (PDT)
Date: 2009-09-12T04:27:05-07:00	[thread overview]
Message-ID: <45566bbf-13fd-43c9-85df-b031f3dfe6f3@h13g2000yqk.googlegroups.com> (raw)
In-Reply-To: 7f203a86-e052-46b8-912f-03900b8025c4@r39g2000yqm.googlegroups.com



RasikaSrinivasan@gmail.com ha scritto:
> is there such a package that allows get/put from/to strings? thanks
> for any pointers, srini

Yes, Text_IO itself... To be more precise, the generic packages (e.g.,
Integer_IO, Modular_IO, ...) contained in Text_IO.  This means that
you will need to specialize them before use.  Check Appendix A.10 of
the beloved RM (Reference Manual) for more informations.

Example:

--- File test.adb ------
with Text_Io;

procedure Test is
   -- Specialize Text_Io.Integer_Io
   package Int_Io is new Text_Io.Integer_Io(Integer);

   Buffer : String(1..5) := (others => 'x');
begin
   Int_Io.Put(Buffer, 42);
   Text_Io.Put_Line("[" & Buffer & "]"); -- will print [   42]
end Test;



  parent reply	other threads:[~2009-09-12 11:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-12 10:50 Ada equivalent of c++ strstream RasikaSrinivasan@gmail.com
2009-09-12 11:25 ` Jeffrey R. Carter
2009-09-12 11:27 ` mockturtle [this message]
2009-09-13  5:58 ` Gautier write-only
replies disabled

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