comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: How to write "Hello" to a text file without a line terminator
Date: Fri, 12 Aug 2016 08:46:18 +0100
Date: 2016-08-12T08:46:18+01:00	[thread overview]
Message-ID: <lyzioi1lbp.fsf@pushface.org> (raw)
In-Reply-To: nojti9$8sq$1@gioia.aioe.org

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> writes:

> On 12/08/2016 06:05, Jerry wrote:
>> How does one write "Hello" to a text file without a line terminator?
>>
>> Put("Hello");
>>
>> adds a line terminator after "Hello".
>
> No, it does not, if you are talking about the standard library Put.
>
> It is Put_Line that does.

Dmitry, Jerry has obviously seen this behaviour under _some_ circumstances,
so perhaps we should think about what those circumstances might have
been!

If the 'Put("Hello");' is the last output before the output file is
closed, probably by ending the program, then ARM A.10.2(3) applies:

   For the procedure Close: If the file has the current mode Out_File or
   Append_File, *has the effect of calling New_Page*, unless the current
   page is already terminated; then outputs a file terminator.

and ARM A.10.5(16) for New_Page:

   Operates on a file of mode Out_File or Append_File. *Outputs a line*
   *terminator if the current line is not terminated*, or if the current
   page is empty (that is, if the current column and line numbers are
   both equal to one). Then outputs a page terminator, which terminates
   the current page. Adds one to the current page number and sets the
   current column and line numbers to one.

Use Ada.Stream_IO, as already suggested, or GNAT.IO - of course the
latter isn't standardised nd its behaviour might change. 


  parent reply	other threads:[~2016-08-12  7:46 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12  4:05 How to write "Hello" to a text file without a line terminator Jerry
2016-08-12  6:41 ` G.B.
2016-08-12  7:23 ` Dmitry A. Kazakov
2016-08-12  7:41   ` J-P. Rosen
2016-08-12  7:46     ` Jerry
2016-08-12  7:44   ` Jerry
2016-08-12 17:34     ` Jeffrey R. Carter
2016-08-13  3:21       ` Jerry
2016-08-13  4:23         ` Jeffrey R. Carter
2016-08-13  9:12           ` AdaMagica
2016-08-13 18:03             ` Jeffrey R. Carter
2016-08-14  7:58               ` AdaMagica
2016-08-14  8:30                 ` Simon Wright
2016-08-14  8:54                   ` Dmitry A. Kazakov
2016-08-14  9:40                     ` Simon Wright
2016-08-14 10:17                       ` Dmitry A. Kazakov
2016-08-14 11:28                         ` Simon Wright
2016-08-14 13:31                           ` Dmitry A. Kazakov
2016-08-15 23:35                       ` Randy Brukardt
2016-08-14 13:28                   ` AdaMagica
2016-08-14 13:54                     ` Simon Wright
2016-08-14 17:05                     ` Jeffrey R. Carter
2016-08-14 18:26                       ` AdaMagica
2016-08-14 19:19                         ` Dmitry A. Kazakov
2016-08-14 13:32                   ` AdaMagica
2016-08-14 16:39                   ` Jeffrey R. Carter
2016-08-12  7:46   ` Simon Wright [this message]
     [not found]   ` <noka54$ci$1@dont-email.me>
2016-08-12 13:44     ` Dmitry A. Kazakov
replies disabled

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