bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Should file be closed if `getline < file` returns -1?


From: Andrew J. Schorr
Subject: Re: [bug-gawk] Should file be closed if `getline < file` returns -1?
Date: Thu, 31 Jan 2019 22:54:08 -0500
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Jan 31, 2019 at 03:41:14PM -0600, Peng Yu wrote:
> My understanding is that there is no need to close file if `getline <
> file` returns -1 as it fails to read the file (most likely the file is
> never opened).
> 
> Is it so? Thanks.

Most likely, but not in all cases. Exceptions include read timeouts and
non-blocking I/O. It is safest to close the file.

Regards,
Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]