readln() returns new line charater

Regan Heath regan at netmail.co.nz
Mon Dec 30 04:36:14 PST 2013


On Sat, 28 Dec 2013 17:42:23 -0000, Jakob Ovrum <jakobovrum at gmail.com>  
wrote:

> On Saturday, 28 December 2013 at 17:23:30 UTC, Jeroen Bollen wrote:
>> Usually if you're working with a console though the input stream won't  
>> exhaust and thus the blocking 'readln' would be a better option, no?
>
> The blocking behaviour of `stdin` by default is fine. The issue is that  
> `readln` returns an empty string when `stdin` is empty/closed, which is  
> different from an empty line (which is just the line terminator).  
> Approaches that erase the difference with functions like `chomp` can't  
> tell them apart.

Cue "empty vs null" theme music..

R

-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the Digitalmars-d mailing list