User input readline || readf

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Apr 23 11:47:03 PDT 2015


On 4/23/15 1:17 PM, kerze wrote:
> The problem is, it writes instant "Name: Age:" at the standart output.

readf reads the element from the stream, and NOTHING MORE, it leaves the 
newline on the stream.

So the next readf then reads the newline as a string. You can fix this 
by using readf(" %s"), which means "read any whitespace, then my data".

-Steve


More information about the Digitalmars-d-learn mailing list