Reading whitespace separated strings from stdin?
TheGag96 via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Apr 20 19:04:23 PDT 2015
On Tuesday, 21 April 2015 at 01:46:53 UTC, Adam D. Ruppe wrote:
> I think this should work:
>
> import std.stdio;
>
> void main() {
> string token;
> while(readf("%s ", &token))
> writeln(token);
> }
>
>
> Have you tried that? What is wrong with it if you have?
It'll just leave some trailing whitespace, which I don't want.
And somehow doing token = token.stip STILL leaves that whitespace
somehow...
More information about the Digitalmars-d-learn
mailing list