www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - stream.readf BUG ?

-------------------------------
void main()
{
	char[] s = "000a1234567890";
	auto stream = new TArrayStream!(char[])(s);

	int len;
	stream.readf("%04x", &len);
	writefln("length: ", len); // => length: 10, it's right.

	// char[] data = stream.readString(len); // Error: not enough data in stream.
BUG?
	char[] data = stream.readString(len - 1);
	writefln("data: ", data);  // => data: 234567890, should "1234567890". BUG?
}
-----------------------------------
Apr 18 2007