readln() returns new line charater

Vladimir Panteleev vladimir at thecybershadow.net
Sun Dec 29 19:25:55 PST 2013


On Monday, 30 December 2013 at 03:03:37 UTC, Marco Leise wrote:
> Am Sat, 28 Dec 2013 17:08:38 +0000
> schrieb "Vladimir Panteleev" <vladimir at thecybershadow.net>:
>
>> On Saturday, 28 December 2013 at 17:07:23 UTC, Andrei 
>> Alexandrescu wrote:
>> > On 12/28/13 8:49 AM, Jeroen Bollen wrote:
>> >> Why is when you do readln() the newline character (\n) gets 
>> >> read too?
>> >> Wouldn't it make more sense for that character to be 
>> >> stripped off?
>> >
>> > So you know that if it returns an empty string the file is 
>> > done.
>> 
>> And also so a readln/writeln loop preserves line endings.
>
> Detect the bug in this sentence.

:)

Spoiler: readln/write *


More information about the Digitalmars-d mailing list