How does buffering actually work?

Ali Çehreli acehreli at yahoo.com
Thu Feb 28 21:38:28 UTC 2019


On 02/28/2019 01:17 PM, Cleverson Casarin Uliana wrote:

 > I experimented substituting readf for readln, but then it doesn't
 > recognize my Enter presses and hangs on.
 >
 > What is a more suitable aproach to this problem please?

readln and strip works, and formattedRead can be useful as well. I have 
an example here:

   http://ddili.org/ders/d.en/strings.html#ix_strings.readln

import std.stdio;
import std.string;

void main() {
     char[] name;

     write("What is your name? ");
     readln(name);
     name = strip(name);

     writeln("Hello ", name, "!");
}

Ali



More information about the Digitalmars-d-learn mailing list