comp.lang.ada
 help / color / mirror / Atom feed
From: "Marin David Condic, 561.796.8997, M/S 731-96" <condicma@PWFL.COM>
Subject: Re: How to detect new line from std_in?
Date: 1998/04/17
Date: 1998-04-17T00:00:00+00:00	[thread overview]
Message-ID: <98041710220850@psavax.pwfl.com> (raw)


Centaury <utopian@TM.NET.MY> writes:
>I'm writing a program that reads text from std_in whether by keyboard entry
>or file redirection.
>If I have something that looks like this;
>
>harlooo and welcome to
>the greatest circus
>
>my program would only recognise that there is 6 words, instead of 7. This is
>because to and the are joined together and become tothe as the data in my
>linked list.
>
>What is the keyword to detect new line (or is it something else??)
>
    It sounds like you are reading the input a byte at a time with the
    "Get" procedure and, given its semantics, it bypasses the end of
    line marker and starts at the next line of input. You should take
    a serious look at the package Ada.Text_IO. It might suggest easier
    ways to do this, such as reading in a whole line at a time and
    concatenating lines if you want to process the input as a
    character at a time.

    But, given that you want to look at it a character at a time, you
    will want to look up these functions in Ada.Text_IO: End_Of_Line,
    End_Of_Page and End_Of_File. If you're reading a character at a
    time, you probably need to look at all these functions to know
    when to stop.

    MDC

Marin David Condic, Senior Computer Engineer     Voice:     561.796.8997
Pratt & Whitney GESP, M/S 731-95, P.O.B. 109600  Fax:       561.796.4669
West Palm Beach, FL, 33410-9600                  Internet:  CONDICMA@PWFL.COM
=============================================================================
    "Because that's where they keep the money."
        --  Willie Sutton when asked why he robbed banks.
=============================================================================




             reply	other threads:[~1998-04-17  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-04-17  0:00 Marin David Condic, 561.796.8997, M/S 731-96 [this message]
  -- strict thread matches above, loose matches on Subject: below --
1998-04-15  0:00 How to detect new line from std_in? Centaury
1998-04-16  0:00 ` Stephen Leake
replies disabled

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