comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: Preferred way to do binray I/O on standard input/output stream
Date: Sat, 24 Oct 2009 15:57:25 -0700
Date: 2009-10-24T15:57:25-07:00	[thread overview]
Message-ID: <hc0019$nc4$1@news.tornevall.net> (raw)
In-Reply-To: <8ec042f2-5308-4a7c-8f48-a6b72ec8feba@p9g2000vbl.googlegroups.com>

Hibou57 (Yannick Duch�ne) wrote:
> 
> There is no kind of binary mode vs text mode flags with Ada stream/
> file IO, as it there are with C. And then, C files are not typed,
> while Ada files/streams are, thus, this will not make any sense to
> simply talk about binary I/O with Ada. So let simply talk about non-
> text I/O from and to standard input/output.
> 
> When some people need this, what is the typical preferred to do so ?

Package Ada.Text_IO.Text_Streams (ARM A.12.2) allows converting 
Ada.Text_IO.File_Type to Stream_Access and reading and writing them through the 
capabilities of streams. This allows converting standard input and output to 
Stream_Access, since Ada.Text_IO provides the functions Standard_Input and 
Standard_Output which return Ada.Text_IO.File_Type.

For general binary I/O, one can use Ada.Sequential_IO or Ada.Direct_IO 
instantiated with an appropriate type, or Ada.Streams.Stream_IO. For standard 
input and output, however, this can only work if you have a name for these files 
that you can use to open them, and such a name is platform-dependent. The only 
independent way to access these files is through streams and 
Ada.Text_IO.Text_Streams.

-- 
Jeff Carter
"Drown in a vat of whiskey. Death, where is thy sting?"
Never Give a Sucker an Even Break
106



  reply	other threads:[~2009-10-24 22:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-24 22:07 Preferred way to do binray I/O on standard input/output stream Hibou57 (Yannick Duchêne)
2009-10-24 22:57 ` Jeffrey R. Carter [this message]
2009-10-24 23:22   ` Hibou57 (Yannick Duchêne)
2009-10-27  0:34   ` Hibou57 (Yannick Duchêne)
2009-10-27  1:14     ` John B. Matthews
2009-10-27  2:36       ` Hibou57 (Yannick Duchêne)
2009-10-27 16:13         ` John B. Matthews
replies disabled

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