Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
January 31, 2007 Possible bug in std.file.listdir (Linux) | ||||
---|---|---|---|---|
| ||||
Hi! Maybe I'm wrong, but I think I discovered a bug in std.file.listdir. -- [snip] -- import std.file; import std.path; import std.stdio; int main(char[][] args) { char Files[][]=listdir(curdir); foreach(char File[]; Files) { writefln(File); } return 0; } -- [snip] -- This works fine unless there is a file with a '%' in it's name in the current folder. If I put a file called for example "now_i_test%dmd" there, the program prints now_i_testError: std.format and exits. I have only tested it on Linux (Ubuntu 6.10 x86). Best regards, Timo |
January 31, 2007 Re: Possible bug in std.file.listdir (Linux) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Timo Gransch | Timo Gransch wrote: > Hi! > > Maybe I'm wrong, but I think I discovered a bug in std.file.listdir. > [snip] > writefln(File); [snip] > > This works fine unless there is a file with a '%' in it's name in the > current folder. If I put a file called for example "now_i_test%dmd" there, > the program prints > > now_i_testError: std.format > > and exits. > > I have only tested it on Linux (Ubuntu 6.10 x86). Nothing to do with std.file.listdir, just with your use of writefln. writefln treats strings as format strings, except when a previous format string told it to treat it literally. Try this one: writefln("%s", File); There have long been requests for write & writeln (without the 'f') that just print out everything using the default formatting, but so far they haven't been implemented[1]. [1]: At least, in Phobos. I don't know about Ares/Mango/Tango. |
January 31, 2007 Re: Possible bug in std.file.listdir (Linux) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frits van Bommel | Frits van Bommel wrote:
> (...) Try this one:
> writefln("%s", File);
Sorry, I was blind. Works fine now. :)
Thanks for your fast reply, Frits.
Best regards,
Timo
|
January 31, 2007 Re: Possible bug in std.file.listdir (Linux) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Frits van Bommel | Frits van Bommel wrote:
> There have long been requests for write & writeln (without the 'f') that just print out everything using the default formatting, but so far they haven't been implemented[1].
I think you mean "it hasn't been deemed fit for inclusion", it has been implemented multiple times by third parties. Basically it's a boolean...
It's a pity that writeln and readln didn't make into DMD 1.0, I think.
--anders
|
January 31, 2007 Re: Possible bug in std.file.listdir (Linux) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund | Anders F Björklund wrote:
> Frits van Bommel wrote:
>
>> There have long been requests for write & writeln (without the 'f') that just print out everything using the default formatting, but so far they haven't been implemented[1].
>
> I think you mean "it hasn't been deemed fit for inclusion", it has been implemented multiple times by third parties. Basically it's a boolean...
> It's a pity that writeln and readln didn't make into DMD 1.0, I think.
Speaking of the underwhelming maintenance effort being put into the current standard library, what about our hope for salvation? The one that will have us all doing latin dances in the hallways?
Yes, the one they call "TANGO"!
Wasn't it supposed to be hitting the streets about now?
Any updates on the ETA if it ain't gonna be today?
--bb
|
January 31, 2007 Re: Possible bug in std.file.listdir (Linux) | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anders F Björklund | Anders F Björklund wrote:
> Frits van Bommel wrote:
>
>> There have long been requests for write & writeln (without the 'f') that just print out everything using the default formatting, but so far they haven't been implemented[1].
>
> I think you mean "it hasn't been deemed fit for inclusion", it has been implemented multiple times by third parties. Basically it's a boolean...
> It's a pity that writeln and readln didn't make into DMD 1.0, I think.
Right, now that you mention it I *do* remember someone having written a patch.
What was probably fresh in my mind as I wrote that was that just yesterday DMD caught me leaving out the 'f' again and complained about an unknown identifier :(.
|
Copyright © 1999-2021 by the D Language Foundation