From: tmoran@acm.org
Subject: Re: Trying to pass strings to Fortan routines
Date: Sun, 12 Aug 2001 07:14:40 GMT
Date: 2001-08-12T07:14:40+00:00 [thread overview]
Message-ID: <A1qd7.55730$Kd7.31716128@news1.rdc1.sfba.home.com> (raw)
In-Reply-To: 3B765238.6F013AD3@mail.verizon.net
> 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;
next parent reply other threads:[~2001-08-12 7:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3B765238.6F013AD3@mail.verizon.net>
2001-08-12 7:14 ` tmoran [this message]
2001-08-12 15:28 ` Trying to pass strings to Fortan routines Jack Scheible
2001-08-12 18:17 ` tmoran
2001-08-13 18:28 ` Jack Scheible
2001-08-12 4:54 Jack Scheible
2001-08-12 5:24 ` tmoran
2001-08-12 11:17 ` Dan Nagle
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox