I seem to be able to crash writefln

Joel Christensen joelcnz at gmail.com
Wed Mar 9 15:19:55 PST 2011


This is on Windows 7. Using a def file to stop the terminal window 
coming up.

win.def
EXETYPE NT
SUBSYSTEM WINDOWS

bug.d
import std.stdio;
import std.string;

void main() {
	auto f = File( "z.txt", "w" );
	scope( exit )
		f.close;
	string foo = "bar";
	foreach( n; 0 .. 10 ) {
		writefln( "%s", foo );
		f.write( format( "count duck-u-lar: %s\n", n ) );
	}
}

output (from in z.txt):
count duck-u-lar: 0


More information about the Digitalmars-d-learn mailing list