Doc Comments / Phobos /
Std Stdio
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 cmdln.interact library for easier user input handling. Sample code:
int i = userInput!int("Type a number: "); auto num = require!(int, "a > 0 && a <= 10")("Enter a number from 1 to 10");
Links