comp.lang.ada
 help / color / mirror / Atom feed
From: Samuel Tardieu <sam@ada.eu.org>
To: Mindy_matusewicz@ny.essd.northgrum.com
Subject: Re: running an exe from gnat
Date: 1997/03/17
Date: 1997-03-17T00:00:00+00:00	[thread overview]
Message-ID: <qw667yq63dr.fsf@esmeralda.enst.fr> (raw)
In-Reply-To: 332D3BD8.1AC5@ny.essd.northgrum.com


>>>>> "Mindy" == Mindy Matusewicz
>>>>> <Mindy_matusewicz@ny.essd.northgrum.com> writes:

Mindy> I am running gnat for windows nt on my pentium and I need to
Mindy> call an exe program.  How do you do that in Ada?

Just as you does in C, call for example the system()
function. Something such as the following piece of code (untested)
should do the job:

  with Interfaces.C.Strings; use Interfaces.C, Interfaces.C.Strings;
  [...]
     function Execute (Command : String) return int is
        C_Command : chars_ptr := New_String (Command);
        function C_System (Command : chars_ptr) return int;
        pragma Import (C, C_System, "system");
        Result : constant int := C_System (C_Command);
     begin
        Free (C_Command);
        return Result;
     end Execute;
        
  Sam
--
Samuel Tardieu -- sam@ada.eu.org




  reply	other threads:[~1997-03-17  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-03-17  0:00 running an exe from gnat Mindy Matusewicz
1997-03-17  0:00 ` Samuel Tardieu [this message]
1997-03-17  0:00 ` Robert Dewar
1997-03-18  0:00 ` Gautier
replies disabled

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