comp.lang.ada
 help / color / mirror / Atom feed
* Ada equivalent of c++ strstream
@ 2009-09-12 10:50 RasikaSrinivasan@gmail.com
  2009-09-12 11:25 ` Jeffrey R. Carter
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: RasikaSrinivasan@gmail.com @ 2009-09-12 10:50 UTC (permalink / raw)


is there such a package that allows get/put from/to strings? thanks
for any pointers, srini



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

* Re: Ada equivalent of c++ strstream
  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
  2009-09-13  5:58 ` Gautier write-only
  2 siblings, 0 replies; 4+ messages in thread
From: Jeffrey R. Carter @ 2009-09-12 11:25 UTC (permalink / raw)


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

I have no idea what strstream does, so I can't accurately answer your question. 
However, Ada.Text_IO has several nested generic packages that allowing putting 
and getting to and from Strings.

-- 
Jeff Carter
"Many times we're given rhymes that are quite unsingable."
Monty Python and the Holy Grail
57



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

* Re: Ada equivalent of c++ strstream
  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
  2009-09-13  5:58 ` Gautier write-only
  2 siblings, 0 replies; 4+ messages in thread
From: mockturtle @ 2009-09-12 11:27 UTC (permalink / raw)




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;



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

* Re: Ada equivalent of c++ strstream
  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
@ 2009-09-13  5:58 ` Gautier write-only
  2 siblings, 0 replies; 4+ messages in thread
From: Gautier write-only @ 2009-09-13  5:58 UTC (permalink / raw)


On 12 sep, 12:50, "RasikaSriniva...@gmail.com"
<rasikasriniva...@gmail.com> wrote:
> is there such a package that allows get/put from/to strings? thanks
> for any pointers, srini

I guess you are looking for something like Unbounded_Stream in the
package Zip_Streams:
http://unzip-ada.sourceforge.net/za_html/zip_streams__ads.htm#52_9
(indeed the "Zip" in that package is unhappy, it is a general-purpose
package (stream with name & time))
HTH
_________________________________________________________
Gautier's Ada programming -- http://sf.net/users/gdemont/
NB: For a direct answer, e-mail address on the Web site!



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

end of thread, other threads:[~2009-09-13  5:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2009-09-13  5:58 ` Gautier write-only

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