November 08, 2017
Is there any other way to do a simple user input into integer variables without using std.conv?
November 08, 2017
On 11/08/2017 09:19 AM, Namal wrote:
> Is there any other way to do a simple user input into integer variables without using std.conv?

import std.stdio;

void main() {
    int i;
    readf(" %s", &i);    // You can use %d as well

    // You can wrap readf in a function template for a more natural use:
    int j = read!int();
}

T read(T)()
{
    T value;
    readf(" %s", &value);
    return value;
}

Ali