How to add elements to dynamic array of dynamic array
katuday via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jun 7 09:50:08 PDT 2014
I am very new to D. How do I add elements to a dynamic array of
dynamic array.
This is my code that fails to compile.
void ex1()
{
alias the_row = string[];
alias the_table = the_row[];
File inFile = File("account.txt", "r");
while (!inFile.eof())
{
string row_in = chomp(inFile.readln());
string[] row_out = split(row_in,"\t");
the_table ~= row_out; //Error: string[][] is not an lvalue
}
writeln(the_table.length); // Error: string[][] is not an
expression
}
More information about the Digitalmars-d-learn
mailing list