comp.lang.ada
 help / color / mirror / Atom feed
From: mfeldman@seas.gwu.edu (Michael Feldman)
Subject: Re: GNAT not 'getting' CR or LF?
Date: 30 Dec 1994 12:39:28 -0500
Date: 1994-12-30T12:39:28-05:00	[thread overview]
Message-ID: <3e1gkg$b8o@felix.seas.gwu.edu> (raw)
In-Reply-To: 1994Dec29.230538.15695@nmt.edu

In article <1994Dec29.230538.15695@nmt.edu>,
Smilin' Ron Finkbine <finkbine@nmt.edu> wrote:
>I am using the gnat system (DOS version) and am writing a 
>Fortran scanner. I am having a problem with the Text_IO.get
>function getting a character. It seems to ignore the carriage
>return and linefeed characters.
>
>What knowledge about gnat am I missing?
>
Not a GNAT issue. Text_IO.Get is doing exactly what the LRM requires.
Quoting from 9XLRM A.10.7:

"After skipping any line terminators and any page terminators,
reads the next character from the specified input file..."

in other words, the procedure is designed to ignore the CRs and LFs.
The behavior is the same in Ada 83 and Ada 95.

To detect EOL in Ada, it's best and most portable to use the 
Text_IO.End_Of_Line function, since in Ada EOL is not treated as a 
character, but as an abstraction. This is Pascal-ish, not C-ish,
input behavior. For more details, see the LRM (Ada 83 or 95) or a good
textbook description of Text_IO.

Hope this helps.

Mike Feldman
------------------------------------------------------------------------
Michael B. Feldman -  chair, SIGAda Education Working Group
Professor, Dept. of Electrical Engineering and Computer Science
The George Washington University -  Washington, DC 20052 USA
202-994-5919 (voice) - 202-994-0227 (fax) - mfeldman@seas.gwu.edu (Internet)
------------------------------------------------------------------------
         Ada on the World-Wide Web: http://lglwww.epfl.ch/Ada/
------------------------------------------------------------------------
"Illegitimi non carborundum." (Don't let the bastards grind you down.)
------------------------------------------------------------------------



  parent reply	other threads:[~1994-12-30 17:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-12-29 23:05 GNAT not 'getting' CR or LF? Smilin' Ron Finkbine
1994-12-30 15:23 ` Kevin Weise
1994-12-30 17:39 ` Michael Feldman [this message]
1995-01-02  4:42 ` Robert Dewar
1995-01-03  2:56   ` Keith Thompson
1995-01-05  0:16     ` Kurt Bischoff
1995-01-06  3:21       ` Keith Thompson
1995-01-04 11:47 ` Joerg Rodemann
replies disabled

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