comp.lang.ada
 help / color / mirror / Atom feed
From: dale@cs.rmit.edu.au (Dale Stanbrough)
Subject: Re: System call
Date: 1998/09/30
Date: 1998-09-30T05:14:02+00:00	[thread overview]
Message-ID: <dale-3009981515400001@dale.ppp.cs.rmit.edu.au> (raw)
In-Reply-To: 6ulqvt$728$2@pinah.connect.com.au

In article <6ulqvt$728$2@pinah.connect.com.au>, "Adnan"
<a0mohame@teaching.cs.adelaide.edu.au> wrote:

> How do I use a Unix system call from an Ada program.
> 
> Thanx

by calling the appropriate Unix routine, just as C does.
the code below does this, but is not really the best it could be.

dale


function invoke_system(name     :string) return integer is
        
        C_name  :constant interfaces.c.char_array(1..name'length+1) := 
                interfaces.c.to_C(name);

        function C_system(      name    :system.address)
                                return interfaces.c.int;
        pragma import(C, C_system, "system");
begin
        return integer(C_system(C_name(1)'address));
end;




  reply	other threads:[~1998-09-30  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-28  0:00 System call Adnan
1998-09-30  0:00 ` Dale Stanbrough [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-13 18:43 system call philippe.torgue
2011-08-15 15:40 ` Adam Beneschan
2011-08-15 15:46   ` Adam Beneschan
2011-08-15 16:48     ` philippe.torgue
2011-08-15 19:37       ` anon
2011-08-16 17:18         ` philippe.torgue
2011-08-15 16:32   ` philippe.torgue
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox