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=0.3 required=5.0 tests=BAYES_00,STOX_REPLY_TYPE, STOX_REPLY_TYPE_WITHOUT_QUOTES,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,e08226482c37d6ac,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.189.72 with SMTP id gg8mr2223890pbc.4.1328192051112; Thu, 02 Feb 2012 06:14:11 -0800 (PST) Path: lh20ni252367pbb.0!nntp.google.com!news2.google.com!news.glorb.com!feeder.erje.net!feed.xsnews.nl!border-1.ams.xsnews.nl!post-feeder-02.xsnews.nl!frontend-F10-02.ams.textnews.kpn.nl From: "ldries46" Newsgroups: comp.lang.ada Subject: Writing to string Date: Thu, 2 Feb 2012 15:13:35 +0100 MIME-Version: 1.0 X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Newsreader: Microsoft Windows Live Mail 15.4.3538.513 X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3538.513 Message-ID: <4f2a9a63$0$4819$703f8584@textnews.kpn.nl> Organization: KPN.com NNTP-Posting-Host: 77.168.179.107 X-Trace: 1328192099 textnews.kpn.nl 4819 77.168.179.107@kpn/77.168.179.107:50798 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit Date: 2012-02-02T15:13:35+01:00 List-Id: In C/C++ the possibility exists to write to a string. Is there something like that in ADA? I want to write several floating and fixed point parameters to a string with each a dedicated but different number of digits behind the decimal point. for instance a= 4.10 b= 5.2 c=7.123 In C/C++ it can be done by sprintf("a= %.2f b=%.1f c=%.3f",a,b,c); I have seen that in Ada writing to a file or a device it can also be done with the PUT precedure from Text-IO but I cannot find the way to use PUT for outputing to a string. I possibility that crossed my mind is using the Fixed point types but converting the floating point values to fixed point values in a way that I can use a temporary type declared like: type number is delta fix_p(after) range <>; where fix_p is an array (0.1, 0.01, 0.001) and after is 1, 2 or 3 doesnot seem to work because fix_p(after) is not static. How can I reach my objective or should I completely write it myself? L. Dries