Is there a less ugly way to do input in D than scanf()?

d, input, scanf

Solution

- `readf("%d", &foo);` allows working with `std.stdio.File` rather than C `FILE*`

- `foo = readln().strip().to!int();`

- For reading entire files with lines formatted in the same way: `int[] numbers = slurp!int("filename", "%d");`

Problem

Currently the only way I know how to do input in D is with the scanf() function. But god damn it's ugly. You would think that since it's an upgrade from C that they would have fixed that. I'm looking for a way to do it with a single argument. Currently you have to do: ``` int foo = 0; scanf("%i", &foo); writeln("%i", foo); ``` But it would look a lot cleaner with a single argument. Something like: ``` int foo = 0; scanf(foo); writeln(foo); ``` Thanks.

Original source