File.readfln

uint readfln(alias format, Data...)(auto ref Data data) if (isSomeString!(typeof(format)))

Reads a line from the file and parses it using formattedRead.

Parameters

formatThe format string. When passed as a compile-time argument, the string will be statically checked against the argument types passed.
dataItems to be read.

Returns

Same as formattedRead: the number of variables filled. If the

input ends early, this number will be less that the number of variables provided.

Example:

// sum_rows.d
void main()
{
    import std.stdio;
    auto f = File("input");
    int a, b, c;
    while (f.readfln("%d %d %d", a, b, c) == 3)
    {
        writeln(a + b + c);
    }
}

% cat << EOF > input

1 2 3 4 5 6 7 8 9 EOF % rdmd sum_rows.d 6 15 24

uint readfln(Data...)(scope const(char)[] format, auto ref Data data)

ditto