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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no 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 14:12:32 PST Path: newsfeed.google.com!newsfeed.stanford.edu!cyclone.bc.net!news-hog.berkeley.edu!ucberkeley!newshub.sdsu.edu!newspeer.cts.com!galanthis.cts.com!127.0.0.1.MISMATCH!not-for-mail Sender: kst@king.cts.com Newsgroups: comp.lang.ada Subject: Re: Yet another question on system calls(newbie question) References: From: Keith Thompson Date: 10 May 2001 14:12:31 -0700 Message-ID: X-Newsreader: Gnus v5.5/Emacs 20.3 NNTP-Posting-Host: 209.68.192.180 X-Trace: 989529151 nntp.cts.com 238 209.68.192.180 Xref: newsfeed.google.com comp.lang.ada:7513 Date: 2001-05-10T14:12:31-07:00 List-Id: =?iso-8859-1?Q?Torbj=F6rn?= Karfunkel writes: > 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; > > /Torbj�rn Karfunkel It's been a while since I've done any of this stuff. The C "system" function takes a C string, i.e., a pointer to the first character of a string terminated with a null ('\0') character. Is pragma Import smart enough to do the necessary conversion, or do you have to use Interfaces.C.Strings? I would expect that at least you'd have to append the null character explicitly. -- Keith Thompson (The_Other_Keith) kst@cts.com San Diego Supercomputer Center <*> Cxiuj via bazo apartenas ni.