Doc Comments / Phobos /
Std Stdio
Difference (last change) (no other diffs, normal page display)
Changed: 18c18
Note: You might want to try using the [1] library for easier user input handling. Sample code: |
Note: You might want to try using the ![]() |
std.stdio
Comments
Contrary to what is stated in the online documentation, readf does not read in a full line. If you would like to read in the line "5 6 7 8" into four integers a, b, c, d via readf you can for example do this with
readf("%s", &a); readf(" %s", &b); readf(" %s", &c); readf(" %s", &d);(of course readf("%s %s %s %s", &a, &b, &c, &d); would be better here)
the spaces in the format sting need to be exactly like the above. Unfortunately there is nothing like
a = read!int();Note: You might want to try using the

int i = userInput!int("Type a number: "); auto num = require!(int, "a > 0 && a <= 10")("Enter a number from 1 to 10");
Links