From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: "J-P. Rosen" Newsgroups: comp.lang.ada Subject: Re: Ada.Text_IO.File_Type object with user defined Get and Put subprograms. Date: Thu, 30 Jul 2020 23:51:38 +0200 Organization: Adalog Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Thu, 30 Jul 2020 21:51:38 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="249c6dc6b40b0a0dc22828fa68d33983"; logging-data="10255"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/w0MIR+47ESrTqhXX4SUBw" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 Cancel-Lock: sha1:aZtaHVUtM942lhv54gOlbRUUNd8= In-Reply-To: Content-Language: fr Xref: reader01.eternal-september.org comp.lang.ada:59605 List-Id: Le 30/07/2020 à 22:21, Blady a écrit : > Given a legacy code calling many Put_Line from Ada.Text_IO which works > nice in a Terminal, I want to add a mode which sends these outputs to > another process without changing the legacy code too much. > And I want to keep the Terminal mode. > > Is there a way to create a File_Type object (from Ada.Text_IO) which > would have user defined Get and Put subprograms instead of the > predefined ones of the file system? > > Thus in my case, I will create a custom File_Type object My_Output with > the user define Put which will send the lines to the other process and > then I will call "Set_Output (My_Ouput);" before the legacy code. > Why don't you simply pipe the first process to the second one? -- J-P. Rosen Adalog 2 rue du Docteur Lombard, 92441 Issy-les-Moulineaux CEDEX Tel: +33 1 45 29 21 52, Fax: +33 1 45 29 25 00 http://www.adalog.fr