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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e76285581f537e18 X-Google-Attributes: gid103376,public From: Larry Hazel Subject: Re: Pipe UNIX-commands Date: 1996/08/21 Message-ID: <321B21B2.1F32@cpmx.saic.com>#1/1 X-Deja-AN: 175513701 references: to: Markus Wahl content-type: text/plain; charset=us-ascii organization: SAIC mime-version: 1.0 reply-to: Larry.H.Hazel@cpmx.saic.com newsgroups: comp.lang.ada x-mailer: Mozilla 3.0 (WinNT; I) Date: 1996-08-21T00:00:00+00:00 List-Id: Markus Wahl wrote: > > I'd like to know how I can make unix-commands from inside my ada-program. > > Eg: The program shall pipe out the command 'ls' and then make something > within the program with the output of 'ls'. Am I clear? I don't remember the details of the unix system call, I think it may be 'system' (try 'man system' to check it out). I no longer have access to unix. Anyway, you can import this C function and run any command from your Ada program that you can run from the shell prompt and can include I/O redirection. Something like: with Interfaces.C; procedure Execute_Unix_Command (Command_Line : Interfaces.C.Char_Array); pragma Import (C, Execute_Unix_Command, "system"); ... Execute_Unix_Command (Interfaces.C.To_C ("ls > result_file")); Now you can open result_file with Text_IO and read it. There are probably other ways. Hope this helps -- Larry Hazel => Larry.H.Hazel@cpmx.saic.com (205) 876-4509 -- I try to stay above C level, I get C sick. -- Team Ada & Team OS/2