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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1c1739e9e6a4a7c5 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "Alex R. Mosteo" Newsgroups: comp.lang.ada Subject: Re: binding to C: popen Date: Tue, 21 Feb 2006 17:12:04 +0100 Message-ID: <43FB3BD4.7050700@mailinator.com> References: <43fb258f$0$170$edfadb0f@dread11.news.tele.dk> <1140535533.025063.163680@g14g2000cwa.googlegroups.com> <43fb35a4$0$178$edfadb0f@dread11.news.tele.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net xhL10Rge0yosmuhoahMiDwZttewHU+ItgCv6VmhnsWpvrp36A= User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en In-Reply-To: <43fb35a4$0$178$edfadb0f@dread11.news.tele.dk> Xref: g2news1.google.com comp.lang.ada:3042 Date: 2006-02-21T17:12:04+01:00 List-Id: Poul-Erik Andreasen wrote: > jimmaureenrogers@worldnet.att.net wrote: > >> Poul-Erik Andreasen wrote: >> >>> This ictually going as it is suppose to, but i would like set in an >>> exception if the piping dosn't have succes. Acording to the C manual >>> popen returns null if it fails. But how do i test on that in the >>> FILEs type? >> >> >> >> The popen man page describes the command as: >> FILE *popen(const char *command, const char *mode); >> >> Note that popen returns a file pointer. Upon failure it returns a null >> pointer. >> >> It seems that you might be able to test if the return value is null. >> >> Jim Rogers >> > > Yes but a C pointer is in Ada represented as system.address (...) Not necessarily. Have a look at Interfaces.C, Interfaces.C.Pointers and Interfaces.C.Strings. Also with Gnat an access type with pragma Convention (C, ...) can do the trick. You can easily check for null pointers that way.