From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,cbf5e026169c215b X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!news.mixmin.net!news.tornevall.net!not-for-mail From: "Jeffrey R. Carter" Newsgroups: comp.lang.ada Subject: Re: Preferred way to do binray I/O on standard input/output stream Date: Sat, 24 Oct 2009 15:57:25 -0700 Organization: TornevallNET - http://news.tornevall.net Message-ID: References: <8ec042f2-5308-4a7c-8f48-a6b72ec8feba@p9g2000vbl.googlegroups.com> NNTP-Posting-Host: 16828592c345d0dcffc65a88286ebcc5 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: ae8e154a4c31d0ad864736eaf5e10ec8 X-Complaints-To: abuse@tornevall.net X-Complaints-Language: Spoken language is english or swedish - NOT ITALIAN, FRENCH, GERMAN OR ANY OTHER LANGUAGE! In-Reply-To: <8ec042f2-5308-4a7c-8f48-a6b72ec8feba@p9g2000vbl.googlegroups.com> X-Validate-Post: http://news.tornevall.net/validate.php?trace=ae8e154a4c31d0ad864736eaf5e10ec8 X-SpeedUI: 1738 X-Complaints-Italiano: Parlo la lingua non � italiano User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) X-Posting-User: 9b22bfe2855937f9b3faeec7cfc91295 Xref: g2news2.google.com comp.lang.ada:8780 Date: 2009-10-24T15:57:25-07:00 List-Id: 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