Last update October 9, 2012

Doc Comments / Phobos /
Std Stdio



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");


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: October 9, 2012 0:31 (diff))