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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.28.203.135 with SMTP id b129mr127067wmg.5.1466411657530; Mon, 20 Jun 2016 01:34:17 -0700 (PDT) X-Received: by 10.157.42.81 with SMTP id t75mr127554ota.1.1466411657375; Mon, 20 Jun 2016 01:34:17 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!goblin3!goblin1!goblin.stu.neva.ru!w10no3833142lbo.0!news-out.google.com!di11ni6220lbb.1!nntp.google.com!oe3no5633518lbb.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 20 Jun 2016 01:34:17 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=128.39.191.70; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR NNTP-Posting-Host: 128.39.191.70 References: <226b186b-3ea0-44fc-82cd-97c1e260d368@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <4c9d4577-95ad-4706-a334-cee5f2c2dfbc@googlegroups.com> Subject: Re: How to use/obtain output from system commands (in an Ada program) ? From: reinkor Injection-Date: Mon, 20 Jun 2016 08:34:17 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:30827 Date: 2016-06-20T01:34:17-07:00 List-Id: Thanks a lot, any hint about rpm/repository for gtkada on OpenSuse (Leap) ? reinert On Sunday, June 19, 2016 at 9:24:16 AM UTC+2, Dmitry A. Kazakov wrote: > On 2016-06-19 08:08, reinkor wrote: > > > I am looking for a simple way to obtain output from "xmessage" > > (or dialog/kdialog) in my Ada program. Any good hints? > > The package System.OS_Lib has procedures Spawn that are much more > comfortable to use than system(). > > If you use GtkAda you can start xmessage or any other process with > pipe-lined input/output/error. Then you will have callbacks to process > them. It is also possible to use Gtk_Text_Buffer instead of callbacks. > > http://www.dmitry-kazakov.de/ada/gtkada_contributions.htm#10.1 > > > A trivial way is to output to a file like in this test procedure: > > > > with Interfaces.C; > > with Interfaces.C.Strings; > > with Ada.Text_IO, Text_IO; > > > > procedure Test7 is > > package C renames Interfaces.C; > > use type C.char_array; > > procedure system (Source : in C.char_array); > > pragma Import(C, system, "system"); > > use Ada.Text_IO, Text_IO; > > file1 : File_Type; > > begin > > system("xmessage -center Box1 -buttons label1:X,label2:y -print > choice_file1"); > > Add terminating ASCII NUL here. > > -- > Regards, > Dmitry A. Kazakov > http://www.dmitry-kazakov.de