On Tuesday, 21 April 2015 at 02:04:24 UTC, TheGag96 wrote:
It'll just leave some trailing whitespace, which I don't want.

oh it also keeps the newlines attached. Blargh.

Well, forget the D functions, just use the C functions:

import core.stdc.stdio;

void main() {
        char[16] token;
        while(scanf("%15s", &token) != EOF)
                printf("**%s**\n", token.ptr);
}



You could convert to a string if needed with import std.conv; to!string(token.ptr), but if you can avoid that, you should, this loop has no allocations which is a nice thing.

Reply via email to