Thread overview | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
October 30, 2011 [beginner] Why nothing is printed to stdout ? | ||||
---|---|---|---|---|
| ||||
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 |
October 30, 2011 Re: [beginner] Why nothing is printed to stdout ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frédéric Galusik | On 30.10.2011 11: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
>
Works for me on 2.055 and 2.056 on windows. What compiler and OS are you using?
c:\temp>dmd -w test.d
c:\temp>test|more
.\.a.d.un~ 5326
.\.asciidoc_user-guide.txt.un~ 942
(...)
|
October 30, 2011 Re: [beginner] Why nothing is printed to stdout ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to simendsjo | Le Sun, 30 Oct 2011 12:17:24 +0100, simendsjo a écrit :
> Works for me on 2.055 and 2.056 on windows. What compiler and OS are you using?
>
> c:\temp>dmd -w test.d
> c:\temp>test|more
> .\.a.d.un~ 5326
> .\.asciidoc_user-guide.txt.un~ 942
> (...)
Tested with dmd 2.055 and now 2.056 on Linux
++
|
October 30, 2011 Re: [beginner] Why nothing is printed to stdout ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frédéric Galusik | On Sun, 30 Oct 2011 10:00:21 +0000, 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
works for me, dmd 2.054 linux.
|
October 30, 2011 Re: [beginner] Why nothing is printed to stdout ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frédéric Galusik | "Frédéric Galusik" <fredg@salixosnospam.org> wrote in message news:j8j77l$pfv$1@digitalmars.com... > 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 > My aplogies it you already know this, It's not my intention to be patronizing: You did run the resulting executable, right ( ./test )? And there are files in the dir its beng run from? |
October 30, 2011 Re: [beginner] Why nothing is printed to stdout ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | "Nick Sabalausky" <a@a.a> wrote in message news:j8kd11$25v1$1@digitalmars.com... > "Frédéric Galusik" <fredg@salixosnospam.org> wrote in message news:j8j77l$pfv$1@digitalmars.com... >> 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 >> > > My aplogies it you already know this, It's not my intention to be patronizing: You did run the resulting executable, right ( ./test )? And there are files in the dir its beng run from? > > And you did run it in a DOS window or from a batch file with a PAUSE to allow you to read the output ;-) |
October 30, 2011 Re: [beginner] Why nothing is printed to stdout ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frédéric Galusik | 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 ;) -- Dmitry Olshansky |
October 31, 2011 Re: [beginner] Why nothing is printed to stdout ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Nick Sabalausky | Le Sun, 30 Oct 2011 16:44:20 -0400, Nick Sabalausky a écrit :
> "Frédéric Galusik" <fredg@salixosnospam.org> wrote in message news:j8j77l$pfv$1@digitalmars.com...
>> 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
>>
>>
> My aplogies it you already know this, It's not my intention to be patronizing: You did run the resulting executable, right ( ./test )? And there are files in the dir its beng run from?
Don't need to apologize, it's already kind to answer ;)
So, Yes I run the resulting executable in my $HOME dir where there are
many files.
If I run it through Geany (IDE) I only got:
------------------
(program exited with code: 1)
Press return to continue
If I run in my terminal, there's no output.
++ fredg
|
October 31, 2011 Re: [beginner] Why nothing is printed to stdout ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | 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.
++ fredg
|
October 31, 2011 Re: [beginner] Why nothing is printed to stdout ? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frédéric Galusik | On Mon, 31 Oct 2011 06:01:05 -0400, Frédéric Galusik <fredg@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
|
Copyright © 1999-2021 by the D Language Foundation