help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <>
Subject: Re: Weird behavior of Get character with trailing new lines.
Date: Sat, 23 Sep 2023 11:25:05 +0200	[thread overview]
Message-ID: <uematg$o2i1$> (raw)
In-Reply-To: <>

On 2023-09-23 10:39, Niklas Holsti wrote:
> On 2023-09-23 10:02, J-P. Rosen wrote:

>> That's why I never check End_Of_File, but handle the End_Error 
>> exception. It always works.
> True, but it may not be convenient for the overall logic of the program 
> that reads the file. That program often wants do to something with the 
> contents, after reading the whole file, and having to enter that part of 
> the program through an exception does complicate the code a little.

It rather simplifies the code. You exit the loop and do whatever is 
necessary there.

Testing for the file end is unreliable and non-portable. Many types of 
files simply do not support that test. In other cases the test is not 
file immutable with the side effects that can change the program logic.

It is well advised to never ever use it.

Dmitry A. Kazakov

  reply	other threads:[~2023-09-23  9:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-22 19:30 Weird behavior of Get character with trailing new lines Blady
2023-09-22 19:52 ` Niklas Holsti
2023-09-22 20:05 ` Jeffrey R.Carter
2023-09-23  7:02   ` J-P. Rosen
2023-09-23  8:39     ` Niklas Holsti
2023-09-23  9:25       ` Dmitry A. Kazakov [this message]
2023-09-23 14:03         ` Niklas Holsti
2023-09-24  7:50           ` Dmitry A. Kazakov
2023-09-25 19:55       ` Blady
2023-09-26  5:53     ` Randy Brukardt
replies disabled

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