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-7-bit X-Google-Thread: 103376,4d1e35c40963653d X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-12 00:14:41 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newshub2.home.com!news.home.com!news1.rdc1.sfba.home.com.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Trying to pass strings to Fortan routines References: <3B765238.6F013AD3@mail.verizon.net> X-Newsreader: Tom's custom newsreader Message-ID: Date: Sun, 12 Aug 2001 07:14:40 GMT NNTP-Posting-Host: 24.7.82.199 X-Complaints-To: abuse@home.net X-Trace: news1.rdc1.sfba.home.com 997600480 24.7.82.199 (Sun, 12 Aug 2001 00:14:40 PDT) NNTP-Posting-Date: Sun, 12 Aug 2001 00:14:40 PDT Organization: Excite@Home - The Leader in Broadband http://home.com/faster Xref: archiver1.google.com comp.lang.ada:11812 Date: 2001-08-12T07:14:40+00:00 List-Id: > int main(){ > char filename[] = "test.out"; > char str[] = "Testing..."; > print_( filename, str, strlen(filename), strlen(str) ); > } Try: with Interfaces.C; procedure Main is procedure C_Print(Filename, Str : access Interfaces.C.Char; Filename_Length, Str_Length: in Interfaces.C.Size_T); pragma Import(C, C_Print, "print_"); procedure Print(Filename, Str : in String) is C_Filename: Interfaces.C.Char_Array := Interfaces.C.To_C(Filename); C_Str : Interfaces.C.Char_Array := Interfaces.C.To_C(Str); begin C_Print(C_Filename(0)'Unchecked_Access, C_Str(0)'Unchecked_Access, Interfaces.C.Size_T(Filename'Length), Interfaces.C.Size_T(Str'Length)); end Print; begin Print("test.out", "Testing..."); end Main;