comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Is it possible to redirect text output to a String or Unbounded_String?
Date: Thu, 10 Jun 2021 09:00:25 +0200	[thread overview]
Message-ID: <s9sda9$rhm$1@gioia.aioe.org> (raw)
In-Reply-To: 331aa8fb-271a-4a3a-b95e-d10733cbc404n@googlegroups.com

On 2021-06-10 04:17, Jerry wrote:
> Is it possible to redirect text output to a String or Unbounded_String rather than to a file?

 From Ada.Text_IO? No you cannot, File_Type is not tagged. For a stream 
you could.

> I know there are versions of Put that take a string as a first argument but I don't want to have to write a special-purpose version of a stretch of code just for this purpose, since I want to keep the ability to also output text to a terminal.

I would say that one should never use anything but Put_Line and never 
instantiate any I/O packages. First format an output line in a string, 
and then output the string.

I would suggest to define logging/tracing package, instead of doing 
direct output. It always pays off.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  parent reply	other threads:[~2021-06-10  7:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-10  2:17 Is it possible to redirect text output to a String or Unbounded_String? Jerry
2021-06-10  6:50 ` Simon Wright
2021-06-10  7:00 ` Dmitry A. Kazakov [this message]
2021-06-11 13:07   ` Stephane Carrez
2021-06-10  8:31 ` ytomino
2021-06-10  9:09 ` Jeffrey R. Carter
2021-06-10 14:42 ` Stéphane Rivière
2021-06-11  6:51   ` Stéphane Rivière
2021-06-10 17:06 ` Marius Amado-Alves
2021-06-10 21:12 ` Shark8
replies disabled

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