From: Gautier <gautier@fakeaddress.nil>
Subject: Re: Text_IO from a stream
Date: Mon, 31 Mar 2008 21:17:10 +0200
Date: 2008-03-31T21:17:10+02:00 [thread overview]
Message-ID: <47f138b6$1_5@news.bluewin.ch> (raw)
In-Reply-To: <17unr8ffxzcm.1ee1ucd0fwd1q$.dlg@40tude.net>
Dmitry A. Kazakov:
> But a stream has no defined formatting and is unrelated to ASCII.
Still, you can read the stream through Character'Read(s,c).
> Then the idea of parsing stream looks problematic. If you have in the stream a
> sequence " + -", what Get should do after discovering '-'?
Exactly the same behaviour as when parsing an ill-formatted text.
Reading a text file (or supposedly so) indirectly via a stream and Stream_IO
would have the same result that via Ada.Text_IO.
> Anyway, it is quite simple to do. You can do
>
> type Formatted_Stream (Source : access Root_Stream_Type'Class) is
> tagged limited private;
> function Get (Stream : access Formatted_Stream) return Integer;
> ...
>
> The implementation of Formatted_Stream will use Source for all its I/O. So
> you could hang it on any existing stream.
Fine, seems I need to rewrite a Text_IO for streams. I hoped for a ready-made
solution...
Well, I think I'll switch to a binary format...
______________________________________________________________
Gautier -- http://www.mysunrise.ch/users/gdm/index.htm
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm
NB: For a direct answer, e-mail address on the Web site!
next prev parent reply other threads:[~2008-03-31 19:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-31 15:27 Text_IO from a stream gautier_niouzes
2008-03-31 15:49 ` Dmitry A. Kazakov
2008-03-31 16:05 ` gautier_niouzes
2008-03-31 16:33 ` Dmitry A. Kazakov
2008-03-31 19:17 ` Gautier [this message]
2008-03-31 19:47 ` Dmitry A. Kazakov
2008-03-31 20:54 ` Gautier
2008-04-01 7:49 ` Dmitry A. Kazakov
2008-04-01 20:49 ` Simon Wright
2008-04-02 7:36 ` Dmitry A. Kazakov
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox