From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-91-241.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=NICE_REPLY_A autolearn=ham autolearn_force=no version=3.4.6 Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: "Jeffrey R.Carter" Newsgroups: comp.lang.ada Subject: Re: Weird behavior of Get character with trailing new lines. Date: Fri, 22 Sep 2023 22:05:55 +0200 Organization: A noiseless patient Spider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 22 Sep 2023 20:05:56 -0000 (UTC) Injection-Info: dont-email.me; posting-host="bfeeae48422f80c6870c9baeced2c108"; logging-data="265037"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+d08A3EwensA2ctlqwP4o8TWe/TeSyvI8=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Cancel-Lock: sha1:MEPLJmvZjqLmXR58PZMxMHbxC5Y= Content-Language: en-US In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:65697 List-Id: On 2023-09-22 21:30, Blady wrote: > > A.10.7 Input-Output of Characters and Strings > For an item of type Character the following procedures are provided: > procedure Get(File : in File_Type; Item : out Character); > procedure Get(Item : out Character); > After skipping any line terminators and any page terminators, reads the next > character from the specified input file and returns the value of this character > in the out parameter Item. > The exception End_Error is propagated if an attempt is made to skip a file > terminator. As you have quoted, Get (Character) skips line terminators. End_Of_File returns True if there is a single line terminator before the file terminator, but False if there are multiple line terminators before the file terminator. So you either have to explicitly skip line terminators, or handle End_Error. -- Jeff Carter "Unix and C are the ultimate computer viruses." Richard Gabriel 99