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: 103376,624c77c4e3ffaa2 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!r37g2000prr.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Defaulting to Standard_Output Date: Thu, 23 Oct 2008 18:49:14 -0700 (PDT) Organization: http://groups.google.com Message-ID: <7decfc0d-26ef-4539-8d2e-7e0bce88cfbd@r37g2000prr.googlegroups.com> References: <3a558b10-da3e-4dfa-93e1-573170dfa565@x1g2000prh.googlegroups.com> NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1224812955 9456 127.0.0.1 (24 Oct 2008 01:49:15 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 24 Oct 2008 01:49:15 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r37g2000prr.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.7.12) Gecko/20050922 Fedora/1.7.12-1.3.1,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:2480 Date: 2008-10-23T18:49:14-07:00 List-Id: On Oct 23, 6:14 pm, deadlyhead wrote: > On Oct 23, 5:16 pm, "Jeffrey R. Carter" > > wrote: > > deadlyhead wrote: > > > > If anybody has a better way of handling defaulting to Standard_Output, > > > I'd like to see it. This works for me, and seems elegant enough. It > > > avoids a lot of messy conditionals in the body, anyway. > > > This is what Ada.Text_IO.Set_Output is for. > I looked over Set_Output in the ARM and I went back looking for it in > the comp.lang.ada, and it looks to me that Set_Output will direct all > Put statements to Outfile if a file isn't designated, rather than > having calls of Put (Outfile, Item) appear in Standard_Output. > > This doesn't appear to be the functionality I'm looking for. If no > file is specifically named for Outfile, I want all output to appear on > the terminal. If a file is named for Outfile, then direct output to > that. Using Set_Output (Outfile), wouldn't I still need a Create > statement for Outfile? Well, yes. If you want to create a file, you need to call Create. There isn't anything in the Ada libraries that I know of that will create a file without you telling it to. But why would that be a problem? If Name /= "", call Create, then call Set_Output. -- Adam