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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,68086e17863535f7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-05-10 09:20:02 PST Path: newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!wn1feed!worldnet.att.net!135.173.83.71!wnfilter1!worldnet-localpost!bgtnsc06-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3AFAC042.E2477223@worldnet.att.net> From: James Rogers X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Yet another question on system calls(newbie question) References: Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Thu, 10 May 2001 16:20:02 GMT NNTP-Posting-Host: 12.86.38.36 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc06-news.ops.worldnet.att.net 989511602 12.86.38.36 (Thu, 10 May 2001 16:20:02 GMT) NNTP-Posting-Date: Thu, 10 May 2001 16:20:02 GMT Organization: AT&T Worldnet Xref: newsfeed.google.com comp.lang.ada:7488 Date: 2001-05-10T16:20:02+00:00 List-Id: Torbj�rn Karfunkel wrote: > > Using the pragma Import method of calling non-Ada entities, am I only > allowed to define functions? How about procedures? What I want to do is > to create a text file, give this text file as a parameter to a C > program, and then wait until the C program finishes. By then it will > have produced another text file that I want to use. > Can I use a dummy result variable like the 'result' in the following > (from another mail): > > procedure Command is > > function C_System(value : String) return integer; > pragma Import( > C, C_System, "system"); > > result : integer; > begin > result := C_System("pwd "); > result := C_System(value => "acdsee D:\work\pictures\BP47.jpg "); > end Command; > Do you want to "use" the file with Ada, or with some other system command? Note that the "system" command in Unix can take a string containing an entire pipeline, as in the following example: result := C_System("ps -ef | grep root"); You can also redirect the output of the command as follows: result := C_System("pwd > /tmp/here"); If you want to open a Unix pipe to a system call, and read the result directly, then look at the example I posted on www.adapower.com for using the pipe command. Note that your last proposal, to call the system command with the name of an image file, will not work. The system command only executes files that have executable permissions set. This is not normally true for image files. Jim Rogers Colorado Springs, Colorado USA