comp.lang.ada
 help / color / mirror / Atom feed
* Writing to string
@ 2012-02-02 14:13 ldries46
  2012-02-02 14:40 ` AdaMagica
  2012-02-02 15:57 ` Dmitry A. Kazakov
  0 siblings, 2 replies; 3+ messages in thread
From: ldries46 @ 2012-02-02 14:13 UTC (permalink / raw)


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 




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-02-02 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-02 14:13 Writing to string ldries46
2012-02-02 14:40 ` AdaMagica
2012-02-02 15:57 ` Dmitry A. Kazakov

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