www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Stream.readf bug

reply Ivan Senji <ivan.senji_REMOVE_ _THIS__gmail.com> writes:
int d;
MemoryStream s = new MemoryStream("5");
s.readf("%d",&d);
writefln("d==",d);

prints: d==0

Works if number has more than one digit.
Oct 24 2005
parent "Ben Hinkle" <ben.hinkle gmail.com> writes:
"Ivan Senji" <ivan.senji_REMOVE_ _THIS__gmail.com> wrote in message 
news:djjkg9$1kds$1 digitaldaemon.com...
 int d;
 MemoryStream s = new MemoryStream("5");
 s.readf("%d",&d);
 writefln("d==",d);

 prints: d==0

 Works if number has more than one digit.
looking at the std.stream code I suspect it will be fixed by changing line 684 !eof() to (c != char.init)
Oct 24 2005