I seem to be able to crash writefln
Spacen Jasset
spacenjasset at yahoo.co.uk
Fri Mar 11 15:57:32 PST 2011
On 10/03/2011 12:18, Steven Schveighoffer wrote:
> On Wed, 09 Mar 2011 18:19:55 -0500, Joel Christensen <joelcnz at gmail.com>
> wrote:
>
>> 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
>
> If I dust off my rusty old Windows hat, I believe if you try to write to
> stdout while there is no console window, you will encounter an error.
>
> So don't do that ;) I'm not sure what you were expecting...
>
> -Steve
You normally get no output AFAIR using c++ type compiled programs with
printf or cout -- and perhaps an error set in cout, but I can't remember
about that now.
More information about the Digitalmars-d-learn
mailing list