comp.lang.ada
 help / color / mirror / Atom feed
From: "Zhu, Qun-Ying" <zhu.qunying@gmail.com>
Subject: What's the cause of extra new line with Text_IO when program exit
Date: Thu, 15 Aug 2013 18:02:09 -0700
Date: 2013-08-15T18:02:09-07:00	[thread overview]
Message-ID: <kujtmh$doi$1@dont-email.me> (raw)

Hi,

I have known this problem for quite some time, but did not really know 
why it behave like this.

These two programs:
======================================================================
-- hello.adb
with Ada.Text_IO; use Ada.Text_IO;

procedure Hello is
begin
     Put("Hello");
     Put(" ");
     Put("World!");
end Hello;

-- hello_stream.adb
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Text_IO.Text_Streams; use Ada.Text_IO.Text_Streams;

procedure hello_stream is
     std_out   : Stream_Access;
begin
     std_out := Stream (Standard_Output);

     String'Write (std_out, "Hello");
     String'Write (std_out, " ");
     String'Write (std_out, "World!");
end hello_stream;
==================================================================

When executing, they have different behavior.

For hello, you have:
# ./hello
Hello World!
#

While for hello_stream, you got:
# ./hello_stream
Hello World!#

If change the last Put to Put_Line for hello, you got the same result.
I would like to know why it is like that.

             reply	other threads:[~2013-08-16  1:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-16  1:02 Zhu, Qun-Ying [this message]
2013-08-16  3:17 ` What's the cause of extra new line with Text_IO when program exit Jeffrey Carter
2013-08-17 17:54   ` Dennis Lee Bieber
2013-08-17 21:54     ` Jeffrey Carter
2013-08-19 21:58     ` Randy Brukardt
replies disabled

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