comp.lang.ada
 help / color / mirror / Atom feed
From: jsa@alexandria (Jon S Anthony)
Subject: Re: Two questions
Date: 1996/11/08
Date: 1996-11-08T00:00:00+00:00	[thread overview]
Message-ID: <JSA.96Nov8155648@alexandria> (raw)
In-Reply-To: 32825177.41C6@afit.af.mil


In article <32825177.41C6@afit.af.mil> Ding-yuan Sheu <dsheu@afit.af.mil> writes:

> 	I am converting a C++ application into Ada95 and ran into
> two problems. If you know the answers, please let me know. I appreciate
> your any help.

Sounds good, ;^)

> (1) Is there an easy way to achieve the same result of the C++ sprintf
> function in Ada? I know this may be a FAQ. Your patience and kindness 
> are appreciated.

The absolute simplest way is to import the thing.  There are many
other ways that have been discussed in depth (to death?) and these may
be in the FAQ.


> I work on my project on SGI machines. SGI provides some C++ library 
> binding for Ada programers.

One thing that is sure to work (well, as much as anything...) is to
call the sprintf from a simple wrapper which you hit with export C.
You can then import this function with the standard pragma Import(...,
C) and Interfaces stuff (see the Interfaces package).


> (2) In a C++ function, prorammers can declare a static local variable
> to preserve its value between function calls. Can I do that in Ada?

Look at package level variables.  These do what you want.  Actually, have
a go at the

"Ada95: A guide for C and C++ programmers":

http://www.adahome.com/Ammo/cpp2ada.html

Or just go to the Ada home page: http://www.adahome.com/

and click on "From C/C++ to Ada".

This is thing is really very good for folks in possition like yourself.

/Jon
-- 
Jon Anthony
Organon Motives, Inc.
Belmont, MA 02178
617.484.3383
jsa@organon.com





  parent reply	other threads:[~1996-11-08  0:00 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-11-07  0:00 Two questions Ding-yuan Sheu
1996-11-07  0:00 ` Robert Dewar
1996-11-08  0:00 ` Jon S Anthony [this message]
1996-11-08  0:00 ` Norman H. Cohen
1996-11-08  0:00 ` Robert I. Eachus
  -- strict thread matches above, loose matches on Subject: below --
2002-07-04 22:25 Mark
2002-07-04 22:40 ` Jeffrey Creem
2001-03-12 10:59 Christoph Grein
2001-03-12 17:43 ` Stephen Leake
2001-03-09 18:27 chris.danx
2001-03-09 20:22 ` Mark Lundquist
2001-03-09 20:56 ` Randy Brukardt
2001-03-12 15:36 ` John English
2001-03-12 18:11   ` chris.danx
1996-11-09  0:00 tmoran
1996-11-11  0:00 ` Adam Beneschan
1996-11-13  0:00 ` Richard A. O'Keefe
1996-05-01  0:00 W. Wesley Groleau (Wes)
1996-05-01  0:00 Ed Seidewitz
1996-05-01  0:00 Bernard Banner
1989-04-11 13:32 Piercarlo Grandi
1989-04-14 17:14 ` callen
1989-03-30 11:53 Piercarlo Grandi
1989-04-13  0:46 ` Paul Stachour
1989-03-29  9:16 HansM
1989-03-29 18:35 ` Michael Peirce
1989-03-31 13:10 ` stt
1989-03-31 18:59 ` Scott Simpson
1989-04-03 14:44 ` callen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox