Reading an array of elements with readf in D

Is it possible to read an array (of a given length) of elements using readf in D without a loop?

And is it possible that the length is unknown?

I tried using the same syntax used for formatted writing, %(%d %) , but it does not work.

EDIT: In general, can readf use the same formats for writef ?

+4
source share
1 answer

There is currently an error ( Bugzilla 10060 ) that prevents this from working, but it works for line reading.

 foreach (line; stdin.byLine()) { int[] result; formattedRead(line, "%(%d,%)", &result); writeln(result); } 
+3
source

All Articles