Reading a line from stdin

Gerrit Wichert gwichert at yahoo.com
Wed Mar 16 13:57:58 PDT 2011


Am 16.03.2011 11:09, schrieb spir:
> This is a design bug. 99% of the time one does not want the newline,
> which is not part of the string data, instead just a terminator. Even
> more on stdin where it is used by the user to say "I"m done!".
> If the text is written back to the output /and/ newline is needed,
> it's easy to add it or use writeln.
>
This is a very interesting statement and absolute contrary to my 
experience. I think It is never a design bug  for
a standart function to forward as much information as possible. 
Suppressing unwanted information is very easy,
but getting back some information that has been cut off by a courteous 
tool is an awful job.
That data comes in via stdin doesn't mean is is typed in by the user. 
It's perfectly possible that it is piped in and
  that the line endings should not be touched. You must be a very lucky 
person if you have never been bitten by
such a courteous piece of over engineered software.

I hope you can continue being lucky for a long time. :-)

Gerrit



More information about the Digitalmars-d-learn mailing list