From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: newline in a simple program
Date: Tue, 18 Dec 2007 14:11:22 +0100
Date: 2007-12-18T14:11:24+01:00 [thread overview]
Message-ID: <tejozqy51439.uftetqm6xm6e$.dlg@40tude.net> (raw)
In-Reply-To: M1P9j.7718$wy2.3046@edtnps90
On Tue, 18 Dec 2007 12:28:28 GMT, Paul wrote:
> Hi, given the following two simple programs
>
> hello.adb
> -----------------------
> with ada.text_io;
> procedure hello is
> begin
> ada.text_io.put("hello");
> end hello;
> -----------------------
>
>
> hello.c
> -----------------------
> #include <stdio.h>
> int main()
> {
> printf("hello");
> }
> -----------------------
>
> the result for the ada program is:
> -----------------------
> $ ./hello_in_ada
> hello
> $
> -----------------------
>
> and for the c program:
> -----------------------
> $ ./hello_in_c
> hello$
> -----------------------
>
> The c program does not print a new-line, but the ada program does.
>
> Is there any way to make the ada program not print a new-line?
>
> And is this behavior part of the Ada standard or is it just part of gnat?
>
> I looked for answers, but found none.
You can use stream I/O in order to make sure that Text_IO wouldn't add page
formatting you don't need:
with Ada.Text_IO.Text_Streams;
use Ada.Text_IO;
use Ada.Text_IO.Text_Streams;
procedure Hello is
begin
String'Write (Stream (Standard_Output), "hello");
end Hello;
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2007-12-18 13:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-18 12:28 newline in a simple program Paul
2007-12-18 12:48 ` petter_fryklund
2007-12-18 13:11 ` Dmitry A. Kazakov [this message]
2007-12-18 13:45 ` petter_fryklund
2007-12-18 13:59 ` Dmitry A. Kazakov
2007-12-18 14:13 ` Brian Drummond
2007-12-18 14:49 ` petter_fryklund
2007-12-18 19:40 ` Jeffrey R. Carter
2007-12-18 16:44 ` Adam Beneschan
2007-12-19 4:35 ` anon
2007-12-19 11:43 ` Paul
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox