comp.lang.ada
 help / color / mirror / Atom feed
* Unwanted newline
@ 2005-06-13  9:11 rm-throwaway4
  2005-06-13 11:59 ` Robert A Duff
  2005-06-13 12:12 ` Georg Bauhaus
  0 siblings, 2 replies; 5+ messages in thread
From: rm-throwaway4 @ 2005-06-13  9:11 UTC (permalink / raw)


May be I did not rtfm enough, but I can't find the answer.

rm@gloria ~/abinu
$ cat ctest.c
#include <stdio.h>

void main(void) {
                putchar('X');
}

rm@gloria ~/abinu
$ cat test.adb

with ADA.TEXT_IO;
use  ADA.TEXT_IO;

procedure test is
   package IntIO is new ADA.TEXT_IO.INTEGER_IO(INTEGER);
   use IntIO;

begin

   PUT("X");

end test;

rm@gloria ~/abinu
$ ./ctest;echo Y
XY

rm@gloria ~/abinu
$ ./test;echo Y
X
Y

Apparently Text_Io places newline when program exits even if I did not
ask for it. How to output ONLY "X" in Ada, without newline?




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unwanted newline
  2005-06-13  9:11 Unwanted newline rm-throwaway4
@ 2005-06-13 11:59 ` Robert A Duff
  2005-06-13 12:12 ` Georg Bauhaus
  1 sibling, 0 replies; 5+ messages in thread
From: Robert A Duff @ 2005-06-13 11:59 UTC (permalink / raw)


rm-throwaway4@gunlab.com.ru writes:

> Apparently Text_Io places newline when program exits even if I did not
> ask for it. How to output ONLY "X" in Ada, without newline?

You can avoid Text_IO, and interface directly to C routines.
I've found that to be fairly portable in practise.

- Bob



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unwanted newline
  2005-06-13  9:11 Unwanted newline rm-throwaway4
  2005-06-13 11:59 ` Robert A Duff
@ 2005-06-13 12:12 ` Georg Bauhaus
  2005-06-17 20:20   ` Dr. Adrian Wrigley
  1 sibling, 1 reply; 5+ messages in thread
From: Georg Bauhaus @ 2005-06-13 12:12 UTC (permalink / raw)


rm-throwaway4@gunlab.com.ru wrote:

> begin
> 
>    PUT("X");
> 
> end test;
...
> 
> Apparently Text_Io places newline when program exits even if I did not
> ask for it. How to output ONLY "X" in Ada, without newline?


Ada's Text_IO is a bit more "sophisticated" than C's stdio.
Try using streams instead:

   declare
      bare_out: constant Stream_Access := Stream(Text_IO.Current_Output);
   begin
      Character'write(bare_out, 'X');
   end;


-- Georg 



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unwanted newline
  2005-06-13 12:12 ` Georg Bauhaus
@ 2005-06-17 20:20   ` Dr. Adrian Wrigley
  2005-06-17 20:41     ` Mark Lorenzen
  0 siblings, 1 reply; 5+ messages in thread
From: Dr. Adrian Wrigley @ 2005-06-17 20:20 UTC (permalink / raw)


On Mon, 13 Jun 2005 14:12:57 +0200, Georg Bauhaus wrote:

> Ada's Text_IO is a bit more "sophisticated" than C's stdio.

I hadn't noticed this effect with the newline!
(Put and Put_Line get the same result)

Can you give a more detailed explanation?
(I suppose ploughing through the RM might help...)
-- 
Adrian




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Unwanted newline
  2005-06-17 20:20   ` Dr. Adrian Wrigley
@ 2005-06-17 20:41     ` Mark Lorenzen
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Lorenzen @ 2005-06-17 20:41 UTC (permalink / raw)


"Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk> writes:

> On Mon, 13 Jun 2005 14:12:57 +0200, Georg Bauhaus wrote:
> 
> > Ada's Text_IO is a bit more "sophisticated" than C's stdio.
> 
> I hadn't noticed this effect with the newline!
> (Put and Put_Line get the same result)
> 
> Can you give a more detailed explanation?
> (I suppose ploughing through the RM might help...)
> -- 
> Adrian

A.10.2 (3).



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-06-17 20:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-13  9:11 Unwanted newline rm-throwaway4
2005-06-13 11:59 ` Robert A Duff
2005-06-13 12:12 ` Georg Bauhaus
2005-06-17 20:20   ` Dr. Adrian Wrigley
2005-06-17 20:41     ` Mark Lorenzen

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