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?