On Monday, 22 April 2019 at 22:08:33 UTC, Ali Çehreli wrote:
On 04/22/2019 01:45 PM, Andre Pany wrote:
Hi,
following the example from
http://ddili.org/ders/d.en/input.html,
I try to read a value from console on windows (powershell and
dos console).
The code from the example does not work,
writeln is never executed.
import std;
void main()
{
while(true)
{
string name;
readf("%s", name);
writeln(name);
}
}
also this doesn't work:
readf(" %s", name);
The solution is to use readln, which regrettably comes too late
in the book:
http://ddili.org/ders/d.en/strings.html
Ali
I try to rewrite an example from another language. 4 values are
read from console. While readln with strip (and in 2 cases
to!int) works fine, it just not looks that good in comparison to
the other language.
I wonder wheter std.stdio is missing a readfln function. Which
executes readln, strips the #10#13 characters and then executes
formattedRead.
Does that make sense to you?
Kind regards
Andre