hackish writefln? and

david ta-nospam-zz at gmx.at
Sat Apr 28 12:57:21 PDT 2007


Hello all!

Is
	writefln( (i<10?" ":"") ~ "%d: %s", i, v);

supposed to work, according to the specs?
Just looked at them, but couldn't quiet get it.

But nevertheless it *does* work,
no compile/runtime error and it acts
also in the expected way.

BUT: I just came back from hunting (bugs),
and you get an error if you write the above code
in a file, read it in using std.file & std.stream,
and writefln it back to the console:

*** bugtest.txt
writefln( (i<10?" ":"") ~ "%d: %s", i, v);

*** bugtest.d
import std.file, std.stream, std.stdio;
void main()
{
	File file = new File;
	file.open("bugtest.txt");
	char[] line;
	line = file.readLine();
	file.close();
	writefln(line);		// here we get an error
}


david


More information about the Digitalmars-d-learn mailing list