readln() returns new line charater

Jeroen Bollen jbinero at gmail.com
Sun Dec 29 14:03:14 PST 2013


On Sunday, 29 December 2013 at 18:13:30 UTC, Jakob Ovrum wrote:
> On Sunday, 29 December 2013 at 17:25:39 UTC, Jeroen Bollen 
> wrote:
>> Wouldn't byline return an empty string if the inputstream is 
>> exhausted but not closed?
>
> No, both `readln` and `byLine` will block until either EOL or 
> EOF. They differ in their handling of EOF - `readln` returns an 
> empty string, while the result of `byLine` reports empty (it is 
> a range) and calling `front` is an error.

But wouldn't that mean I'd still end up making my char[] mutable, 
as I still need to manually remove the last character, AFTER I 
checked it's not empty?



More information about the Digitalmars-d mailing list