Question regarding readf
Ali Çehreli
acehreli at yahoo.com
Mon Apr 22 22:08:33 UTC 2019
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
More information about the Digitalmars-d-learn
mailing list