Hello I am trying to read in a set of numbers from a text file. The file in questions looks something like this:
35 2 0 1 0 0.49463548699999998 0.88077994719999997 0 1 0.60672109949999997 0.2254208717 0 After each line I want to check how many numbers were on the line I just read. My code to read this file looks like: 1 import std.stdio; 2 import std.conv; 3 4 int main( string[] argv ) { 5 real[] numbers_read; 6 size_t line_count=1; 7 8 auto f = std.stdio.File("test.txt", "r"); 9 foreach( char[] s; f.byLine() ) { 10 string line = std.string.strip( to!string(s) ); 11 auto parts = std.array.splitter( line ); 12 writeln("There are ", parts.length, " numbers in line ", line_count++); 13 foreach(string p; parts) { 14 numbers_read ~= to!real(p); 15 } 16 } 17 f.close(); 18 return 0; 19 } When I try to compile this I get an error: test.d(12): Error undefined identifier 'length; However, shouldn't splitter be returning an array (thats what the docs seem to show)? What is the type of 'parts'? (I tried using std.traits to figure this out, but that just generated more syntax errors for me). Cheers, Craig