comp.lang.ada
 help / color / mirror / Atom feed
From: "Vincent Smeets" <No@Spam.org>
Subject: Re: Fill string with multiple lines from standard_input
Date: Thu, 15 Aug 2002 21:07:39 +0200
Date: 2002-08-15T21:07:39+02:00	[thread overview]
Message-ID: <ajgu9r$8m7$06$1@news.t-online.com> (raw)
In-Reply-To: bnE69.29717$Zl2.6800@sccrnsc02

Hallo,

I have tested your streams and it didn't work! (Win2000 GNAT 3.13p)

I have a file of 253283 bytes (3310 lines with <CR><LF>). I start my program
with:
    prog <file
and I read 249873 bytes in my buffer. That is exactly 3310 bytes less than
the input file. There is probably some input processing that will leave out
the <CR>. How can I also read the <CR>?

I think that Stream_IO won't do any input processing, but with Stream_IO, I
can only read from a file, not from Standard_Input!

Thanks for any help.

"SteveD" <nospam_steved94@attbi.com> wrote in message
news:bnE69.29717$Zl2.6800@sccrnsc02...
>
> "Vincent Smeets" <No@Spam.org> wrote in message
> news:ajebhb$ndl$01$1@news.t-online.com...
> > Is the a nice Ada95 way to do this?
> >
> Try this:
>
> with Ada.Text_Io.Text_Streams;
> with Ada.Streams;
> procedure TestRead is
>
>   in_stream   : Ada.Text_Io.Text_Streams.Stream_Access;
>   out_stream  : Ada.Text_Io.Text_Streams.Stream_Access;
>   input_chars : Ada.Streams.Stream_Element_Array( 1 .. 1024 );
>   last        : Ada.Streams.Stream_Element_Offset;
> begin
>   in_stream :=
Ada.Text_Io.Text_Streams.Stream( Ada.Text_Io.Current_Input );
>   out_stream := Ada.Text_Io.Text_Streams.Stream(
> Ada.Text_Io.Current_Output );
>   Ada.Streams.Read( in_Stream.ALL, input_chars, last );
>   Ada.Streams.Write( out_Stream.ALL, input_chars(1 .. last ) );
> end TestRead;
>
> BTW: There is nothing that says a stream element will correspond to a
> character, but in practice I think it will be.
>
> SteveD
>
>
>




  parent reply	other threads:[~2002-08-15 19:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-14 19:34 Fill string with multiple lines from standard_input Vincent Smeets
2002-08-14 20:37 ` Stephen Leake
2002-08-15 17:57   ` Vincent Smeets
2002-08-15 20:47     ` Stephen Leake
2002-08-19 19:39       ` Vincent Smeets
2002-08-20 15:01         ` Stephen Leake
2002-08-20 18:26           ` Vincent Smeets
2002-08-20 19:46             ` tmoran
2002-08-21 12:50             ` Jean-Pierre Rosen
2002-08-21 19:19             ` Randy Brukardt
2002-08-25  0:34               ` AG
2002-08-21 14:37         ` Kevin Cline
2002-08-21 19:47           ` Robert Dewar
2002-08-22  7:40             ` Kevin Cline
2002-08-23 19:49               ` Peter Richtmyer
2002-08-22 20:36             ` Kevin Cline
2002-08-25  0:45               ` AG
2002-08-26  0:47                 ` Kevin Cline
2002-08-15  2:30 ` SteveD
2002-08-15 18:02   ` Vincent Smeets
2002-08-16  0:25     ` Robert Dewar
2002-08-15 19:07   ` Vincent Smeets [this message]
2002-08-15 21:49     ` chris.danx
2002-08-16 19:30       ` Ted Dennison
2002-08-17  2:26         ` Randy Brukardt
2002-08-17 10:24         ` Robert Dewar
2002-08-19 13:40           ` Ted Dennison
2002-08-20  0:03             ` Robert Dewar
2002-08-16 17:33 ` Alexei Polkhanov
replies disabled

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