Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Array index out of bounds

Moderators: kris

Posted: 09/13/08 23:26:13

I have been trying to figure out whats causing an array index out of bounds exception in this code.

import tango.io.stream.MapStream;
import tango.io.stream.FileStream;
import tango.io.Stdout;

void main()
{
  char[][char[]] props;
  (new MapInput!(char)(new FileInput("mypropfile.props"))).load(props);

  // show all values
  foreach(key, value; props)
     Stdout.formatln("{} = {}", key, value);

  // get a single value
  Stdout.formatln("the value for property.name is {}", props["property.name1"]);

}

But so far I can't even lars can't figure out what the problem is. The contents of mypropfile.props is...

property.name1 = something
property.name2 = somethingelse
Author Message

Posted: 09/14/08 01:07:20

I found a temporary fix, I just commented out the first line of the property file.

Posted: 09/14/08 06:42:08

Oh, is this where you have a BOM in the text?