[Issue 4716] std.stdio.input() or similar

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 28 18:24:05 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=4716



--- Comment #3 from bearophile_hugs at eml.cc 2011-10-28 18:22:54 PDT ---
A D2 program that reads a string from the keyboard:


import std.stdio;
void main() {
    string s = readln();
    writeln(">", s, "<");
}


Running it it shows that the newline is left inside the string s:

...>test
123
>123
<


I don't know other languages where the command line input function leaves the
newline at the end of the input string. This is why in input() I have used
chomp().

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list