comp.lang.ada
 help / color / mirror / Atom feed
* Assembling Complex Strings Containing Carriage Returns Prior to Using Ada.Text_IO.Put?
@ 2014-10-22  5:57 NiGHTS
  2014-10-22  6:20 ` mockturtle
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: NiGHTS @ 2014-10-22  5:57 UTC (permalink / raw)


I am converting some code from C to Ada which involves building a complex string containing '\n' characters which would eventually be displayed on the standard output console using the printf() function. 

I tried to copy the same strategy of building the string in Ada like this:


Complex_String : Ada.Strings.Unbounded.Unbounded_String;
EOL            : String := ASCII.CR'Img;

...

Ada.Strings.Unbounded.Append (Complex_String, 
    "Menu Title"                            & EOL & 
    "-------------------------------------" & EOL
);

...

Ada.Text_Io.Put ( 
Ada.Strings.Unbounded.To_String( Complex_String ) );


Instead of breaking the line in the places where EOL has been inserted, it seems to show the letters "CR" in its place. Due to the complexity of the final displayed text, I cannot print the text to console before I have run through the entire code which generates the text. The code I am converting involves many "Complex_Strings" which are later printed in a specific order depending on certain criteria only known after the fact. Therefore I need to assemble these generated strings along with the carriage returns before displaying them to the user.

The searches I performed on Google seem to be void of any hints on how to get this working. I can't imagine that I am the only one with this requirement in Ada.


Thanks in advance for your advice.

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

end of thread, other threads:[~2014-10-24  2:45 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-22  5:57 Assembling Complex Strings Containing Carriage Returns Prior to Using Ada.Text_IO.Put? NiGHTS
2014-10-22  6:20 ` mockturtle
2014-10-22  6:28   ` Ludovic Brenta
2014-10-22  8:12     ` mockturtle
2014-10-22 14:36     ` Maciej Sobczak
2014-10-22 14:55       ` Dmitry A. Kazakov
2014-10-24  1:35         ` Keith Thompson
2014-10-22 16:01     ` Shark8
2014-10-22 16:50       ` Jeffrey Carter
2014-10-22 18:59         ` Simon Wright
2014-10-22 23:45           ` Dennis Lee Bieber
2014-10-23 11:38             ` G.B.
2014-10-23 16:22               ` Shark8
2014-10-22 17:32     ` Adam Beneschan
2014-10-22 17:55       ` NiGHTS
2014-10-22 17:16   ` NiGHTS
2014-10-22  6:25 ` Jeffrey Carter
2014-10-22 17:39   ` NiGHTS
2014-10-22 11:16 ` Björn Lundin
2014-10-22 17:44 ` Adam Beneschan
2014-10-22 17:47   ` Adam Beneschan
2014-10-22 18:01   ` NiGHTS
2014-10-22 22:34     ` Shark8
2014-10-22 23:32     ` Adam Beneschan
2014-10-24  2:45     ` Randy Brukardt

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