comp.lang.ada
 help / color / mirror / Atom feed
* Can I treat Current_Output as a file of bytes?
@ 2002-11-04 22:34 Bj�rn Persson
  2002-11-05 14:30 ` Ted Dennison
  2002-11-06  8:26 ` Pascal Obry
  0 siblings, 2 replies; 42+ messages in thread
From: Bj�rn Persson @ 2002-11-04 22:34 UTC (permalink / raw)


Hi everyone, here's another beginner having problems with Ada.Text_IO.
Please excuse me if this is a frequently asked question. I couldn't find
it in the collection at http://www.adahome.com/FAQ/comp-lang-ada.html.

I'm writing a little program that reads from standard in and writes to
standard out, but I'd need to treat them as raw files of bytes or
characters, and Text_IO's line-oriented features get in my way. When
reading I can get around it by using Get_Immediate, but I can't get rid of
the extra line break that is written to standard out when the program
terminates if the last character written wasn't a line break. Can I get
full control over standard out without doing all the output by calling C
functions?

The extra line break isn't a big deal when writing to a terminal window,
but it's worse when standard out is redirected to a file.

Bj�rn Persson



^ permalink raw reply	[flat|nested] 42+ messages in thread
* Re: Can I treat Current_Output as a file of bytes?
@ 2002-11-06  5:54 Grein, Christoph
  0 siblings, 0 replies; 42+ messages in thread
From: Grein, Christoph @ 2002-11-06  5:54 UTC (permalink / raw)


> > You should also be aware from A.12.2.(7) that "Performing operations on
> > the stream associated with a text file does not affect the column,
> > line, or page counts."
> 
> Does anybody actually use those counts?
> I've never written code that does.

Sometimes, for formatting,
I store the current Col value and for each new line call Set_Col
                    (no Put_Line needed in that case).
                    I've never used the line and page 
counts.



^ permalink raw reply	[flat|nested] 42+ messages in thread
* Re: Can I treat Current_Output as a file of bytes?
@ 2002-11-07  6:28 Grein, Christoph
  2002-11-07 17:04 ` Bj�rn Persson
  0 siblings, 1 reply; 42+ messages in thread
From: Grein, Christoph @ 2002-11-07  6:28 UTC (permalink / raw)



> X-Trace: newsb.telia.net 1036629893 213.64.50.193 (Thu, 07 Nov 2002 01:44:53 
CET)
> Date: Thu, 07 Nov 2002 00:44:53 +0000 (GMT)
> I want to read as much data as is available, and then process that before
> I wait for more. I thought I had solved that with Get_Immediate, but it
> turns out that Get_Immediate (or rather some underlying C routine)
> translates CR LF to a single LF when running in Windows, and I can't find
> any other way to check if input is available. Neither can I push back what
> I've read with Get_Immediate to read it again with Character'Read.
> 
> (I'm using Gnat 3.14p in Windows and 3.13p in Redhat.)

There are two forms of Get_Immediate: One blocking until data is available, the other not blocking 
and returning a boolean to indicate whether data is available.

There is also a look-ahead.



^ permalink raw reply	[flat|nested] 42+ messages in thread
* Re: Can I treat Current_Output as a file of bytes?
@ 2002-11-07 19:05 Kees de LezenneCoulander
  0 siblings, 0 replies; 42+ messages in thread
From: Kees de LezenneCoulander @ 2002-11-07 19:05 UTC (permalink / raw)


Robert A Duff <bobduff@shell01.TheWorld.com> wrote:

>Does anybody actually use those counts?
>I've never written code that does.

   Sure. We have technical calculation programs that read input
from fairly large and complicated ASCII files. I find it quite
a nice touch that I can quote page, line and column number when
an error occurs.
                          Kees de Lezenne Coulander
-- 
  C.M. de Lezenne Coulander
  Aircraft Development and Systems Engineering B.V.
  Hoofddorp, The Netherlands

  



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

end of thread, other threads:[~2002-11-10 15:37 UTC | newest]

Thread overview: 42+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-04 22:34 Can I treat Current_Output as a file of bytes? Bj�rn Persson
2002-11-05 14:30 ` Ted Dennison
2002-11-05 16:01   ` Bj�rn Persson
2002-11-05 18:13     ` Warren W. Gay VE3WWG
2002-11-05 22:14       ` Bj�rn Persson
2002-11-05 22:48       ` Robert A Duff
2002-11-06  0:42         ` Jeffrey Creem
2002-11-06  7:14         ` Dale Stanbrough
2002-11-06  8:45         ` Fraser Wilson
2002-11-08 10:03         ` Jacob Sparre Andersen
2002-11-05 22:27     ` Ted Dennison
2002-11-06 23:40       ` Randy Brukardt
2002-11-07  2:45         ` Larry Kilgallen
2002-11-07  4:04         ` Ted Dennison
2002-11-07 19:01           ` Bj�rn Persson
2002-11-07 21:04           ` Randy Brukardt
2002-11-08  0:03             ` Bj�rn Persson
2002-11-08  1:36               ` Larry Kilgallen
2002-11-08 14:53                 ` Stephen Leake
2002-11-09 14:33                   ` Marin David Condic
2002-11-09 15:26                     ` Preben Randhol
2002-11-09 14:36                       ` Larry Kilgallen
2002-11-10 15:37                       ` Marin David Condic
2002-11-08 16:40                 ` Bj�rn Persson
2002-11-08 15:55                   ` Larry Kilgallen
2002-11-08 18:07                     ` Bj�rn Persson
2002-11-08 19:09                 ` Matthew Woodcraft
2002-11-08 20:34                 ` Randy Brukardt
2002-11-08 15:10               ` Ted Dennison
2002-11-08 15:57                 ` Larry Kilgallen
2002-11-08 16:16                 ` Preben Randhol
2002-11-08 17:30                 ` Bj�rn Persson
2002-11-08 20:32                 ` Randy Brukardt
2002-11-07  0:44       ` Bj�rn Persson
2002-11-07 14:41         ` Ted Dennison
2002-11-07 17:41           ` Bj�rn Persson
2002-11-09 11:37         ` Georg Bauhaus
2002-11-06  8:26 ` Pascal Obry
  -- strict thread matches above, loose matches on Subject: below --
2002-11-06  5:54 Grein, Christoph
2002-11-07  6:28 Grein, Christoph
2002-11-07 17:04 ` Bj�rn Persson
2002-11-07 19:05 Kees de LezenneCoulander

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