March 12, 2011
On 10/03/2011 12:18, Steven Schveighoffer wrote:
> On Wed, 09 Mar 2011 18:19:55 -0500, Joel Christensen <joelcnz@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.
March 14, 2011
On Fri, 11 Mar 2011 18:57:32 -0500, Spacen Jasset <spacenjasset@yahoo.co.uk> wrote:

> On 10/03/2011 12:18, Steven Schveighoffer wrote:
>> On Wed, 09 Mar 2011 18:19:55 -0500, Joel Christensen <joelcnz@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.

But don't forget, D uses DMC's runtime, not Visual Studio.  Make sure you are comparing to DMC compiled programs.

-Steve
March 16, 2011
On 15/03/2011 1:57 a.m., Steven Schveighoffer wrote:
> On Fri, 11 Mar 2011 18:57:32 -0500, Spacen Jasset
> <spacenjasset@yahoo.co.uk> wrote:
>
>> On 10/03/2011 12:18, Steven Schveighoffer wrote:
>>> On Wed, 09 Mar 2011 18:19:55 -0500, Joel Christensen <joelcnz@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.
>
> But don't forget, D uses DMC's runtime, not Visual Studio. Make sure you
> are comparing to DMC compiled programs.
>
> -Steve

writeln works, just not writefln so much. Haven't tried eg. writeln( format( "%s", value ) );

Can have a version system for with, and with out the terminal. Just don't think I need to do more than just adding and removing the .def file from the compiler arguments.

-Joel
1 2
Next ›   Last »