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-11 18:30:55 PST Path: archiver1.sj.google.com!newsfeed.google.com!newsfeed.stanford.edu!nntp.cs.ubc.ca!newsfeed.direct.ca!look.ca!newshub2.rdc1.sfba.home.com!news.home.com!news1.sttls1.wa.home.com.POSTED!not-for-mail From: "DuckE" Newsgroups: comp.lang.ada References: Subject: Re: Yet another question on system calls(newbie question) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: Date: Sat, 12 May 2001 01:30:54 GMT NNTP-Posting-Host: 24.248.45.203 X-Complaints-To: abuse@home.net X-Trace: news1.sttls1.wa.home.com 989631054 24.248.45.203 (Fri, 11 May 2001 18:30:54 PDT) NNTP-Posting-Date: Fri, 11 May 2001 18:30:54 PDT Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.sj.google.com comp.lang.ada:7413 Date: 2001-05-12T01:30:54+00:00 List-Id: While I'm not familiar with a C_System function, if is in written in C, you most likely should be passing a C string: function C_System(value : Interfaces.C.Char_Array) return integer; pragma Import( C, C_System, "system"); result : integer; begin result := C_System( Interfaces.C.To_C( "pwd " ) ); result := C_System( Interfaces.C.To_C( "acdsee D:\work\pictures\BP47.jpg" ) ); end Command; This turns the Ada string, which includes information about the extent of the string, into a null terminated string. Other answers to questions: You may import functions or procedures. Passing file handles from Ada to C may be tricky. If you use the File_Type defined in Ada's standard libraries, the definition is implementation dependent. You can certainly interface to C functions for doing all I/O in Ada, but I don't know if you can mix Ada and C's native file handling. I hope this helps, SteveD "Torbj�rn Karfunkel" wrote in message news:mailman.989509930.7705.comp.lang.ada@ada.eu.org... > 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 > > >