[beginner] Why nothing is printed to stdout ?

Steven Schveighoffer schveiguy at yahoo.com
Mon Oct 31 07:16:45 PDT 2011


On Mon, 31 Oct 2011 06:01:05 -0400, Frédéric Galusik  
<fredg at salixosnospam.org> wrote:

> Le Mon, 31 Oct 2011 00:55:58 +0400, Dmitry Olshansky a écrit :
>
>> On 30.10.2011 14:00, Frédéric Galusik wrote:
>>> Hi,
>>>
>>> Can someone give me a clue on why nothing is printed to stdout ?
>>>
>>> I wish a list of files with their size.
>>>
>>> code:
>>> //
>>> import std.stdio;
>>> import std.file;
>>>
>>> void main(string[] args)
>>> {
>>>      foreach (DirEntry e; dirEntries(".", SpanMode.shallow)) {
>>>          writeln(e.name, "\t", e.size);
>>>      }
>>> }
>>> //
>>> Build with (dmd2):
>>> dmd -w test.d
>>>
>>>
>> I might be way off on this.
>> Yet this silly stuff used to catch me all the time when switching from
>> windows to *nixes, back and forth:
>>
>> sh$: compile something to 'test'
>> sh$: test
>> no output - WTF? Ahem, it just called that command line tool named
>> test... sh$: ./test
>> wow, now something happens ;)
>
> Ohhh yesss, you got it.
> That was so stupid, a big thanks.
>
> Regards.

Oh I remember doing that too :)  Don't feel bad, everyone does this at  
least once.  I hate that stupid test builtin, nobody ever uses it anymore.

Note, it's not a command line tool, it's a shell builtin, which is why it  
overrides anything in your search path.

I've since adopted the habit of calling test programs "testme" instead of  
"test" :)

-Steve


More information about the Digitalmars-d-learn mailing list