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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c4d884378fc6b03c X-Google-Attributes: gid103376,public From: jsa@alexandria (Jon S Anthony) Subject: Re: Two questions Date: 1996/11/08 Message-ID: #1/1 X-Deja-AN: 195363864 sender: news@organon.com (news) references: <32825177.41C6@afit.af.mil> organization: Organon Motives, Inc. newsgroups: comp.lang.ada Date: 1996-11-08T00:00:00+00:00 List-Id: In article <32825177.41C6@afit.af.mil> Ding-yuan Sheu 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