There is some kind of workaround to take advantage of the following and saving it?
Put_Line(MyNum, Base => 16);
which is converting for instance 255 to its proper value in hexadecimal FF, but just for display purposes. Can I do something similar, but to save the result?
You could use the version of Put that outputs to a string:
procedure Put(To : out String;
Item : in Num;
Base : in Number_Base := Default_Base);
Can I do something similar, but to save the result?
Yes, it's not "the simplest" way, but it's very general and flexible if you use Streams.
The wikibook has an example, though it's a little 'wordy' for what you intend: http://en.wikibooks.org/wiki/Ada_Programming/Libraries/Ada.Streams/Example
The simple "one-liner" is Ada.Integer_Text_IO.Put
.
Ada95's RM describes integer_text_IO in Annex A, 10.8.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With