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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b5cd7bf26d091c6f X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news.glorb.com!feeder.erje.net!feeder.news-service.com!94.75.214.39.MISMATCH!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Reading the while standard input into a String Date: Mon, 6 Jun 2011 16:06:06 +0200 Organization: cbb software GmbH Message-ID: <1qweahw1opg3q$.qlezbqnr1n6w.dlg@40tude.net> References: <4decb6f4$0$6627$9b4e6d93@newsspool2.arcor-online.net> <4decd6ef$0$6581$9b4e6d93@newsspool3.arcor-online.net> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: FbOMkhMtVLVmu7IwBnt1tw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 Xref: g2news2.google.com comp.lang.ada:20610 Date: 2011-06-06T16:06:06+02:00 List-Id: On Mon, 06 Jun 2011 15:32:31 +0200, Georg Bauhaus wrote: > On 06.06.11 14:11, Dmitry A. Kazakov wrote: >> On Mon, 06 Jun 2011 13:16:03 +0200, Georg Bauhaus wrote: >> >>> Very likely, the storage elements can be converted to Character >>> without check, i.e. using an instance of Unchecked_Conversion, >>> or simple the 'Address attribute. So no copying is involved >>> at this stage. >> >> Well, if you *know* that you can read directly into string. Declare fread >> with Address argument and pass the first element's address to it. > > In Ada? Why? :-) Because that would be far easier to read and write: Input : String (1..1024); Count : size_t; begin Count := fread (Input'Address, 1, Input'Length, File); Or are you asking why anybody should use fread? BTW, GtkAda binding consistently uses Address instead of storage elements array. So it was not an idea of mine. (:-)) -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de