Re: Strange behavior of read file

2013-08-27 Thread Paul Jurczak
On Tuesday, 27 August 2013 at 17:19:08 UTC, monarch_dodra wrote: On Tuesday, 27 August 2013 at 17:14:23 UTC, Paul Jurczak wrote: Correction to my initial post: I'll investigate later then. monarch_dodra, H. S. Teoh, Ramon, Justin Whear, Jesse Phillips: Sorry for the delay in responding - I

Re: Strange behavior of read file

2013-08-27 Thread Ramon
Justin Whear & H.S. Teoh Yep, that's what I assumed, too. But that's so C Style. Wouldn't it befit phobos to have sth. like normalizePath? Like: On Unix/linux rep ' ' with '\ ' " replace ~ with $HOME etc. so as to have normalizePath return a path equal to what the shell would do?

Re: Strange behavior of read file

2013-08-27 Thread Jesse Phillips
On Tuesday, 27 August 2013 at 17:14:23 UTC, Paul Jurczak wrote: Correction to my initial post: I oversimplified the code example by snipping too much of context. Here is an example, which fails both on Windows and Linux: I get a range violation in Linux, but that is to be expected since my

Re: Strange behavior of read file

2013-08-27 Thread H. S. Teoh
On Wed, Aug 28, 2013 at 12:51:12AM +0200, Ramon wrote: [...] > Here's what I came up with (on linux): > > - trying with filename r"~/text.txt" (i.e. an existing file in my > home dir) it FAILED. > > - trying with the same filename but this time home dir explicitely > written out fully (r"/home/me

Re: Strange behavior of read file

2013-08-27 Thread Justin Whear
On Wed, 28 Aug 2013 00:51:12 +0200, Ramon wrote: > > - trying with filename r"~/text.txt" (i.e. an existing file in my home > dir) it FAILED. > > - trying with the same filename but this time home dir explicitely > written out fully (r"/home/me/test.txt) it WORKED. > > Conclusion: I assume D's

Re: Strange behavior of read file

2013-08-27 Thread Ramon
I played a little with it int f(string fileName = r"someExistingPath") { auto text = read(fileName); return text.length; } void main() { try { string fileName = r"someExistingPath"; if(exists(fileName)) writeln("File '", fileName, "' does exist."); auto text =

Re: Strange behavior of read file

2013-08-27 Thread monarch_dodra
On Tuesday, 27 August 2013 at 17:19:08 UTC, monarch_dodra wrote: On Tuesday, 27 August 2013 at 17:14:23 UTC, Paul Jurczak wrote: Correction to my initial post: I'll investigate later then. I am unable to reproduce.

Re: Strange behavior of read file

2013-08-27 Thread monarch_dodra
On Tuesday, 27 August 2013 at 17:14:23 UTC, Paul Jurczak wrote: Correction to my initial post: I'll investigate later then.

Re: Strange behavior of read file

2013-08-27 Thread H. S. Teoh
On Tue, Aug 27, 2013 at 07:14:22PM +0200, Paul Jurczak wrote: > Correction to my initial post: > > I oversimplified the code example by snipping too much of context. > Here is an example, which fails both on Windows and Linux: > > module main; > > import std.stdio, std.file, std.string, std.algo

Re: Strange behavior of read file

2013-08-27 Thread monarch_dodra
On Tuesday, 27 August 2013 at 15:45:06 UTC, Paul Jurczak wrote: module main; import std.stdio, std.file, std.string, std.algorithm, std.range, std.datetime, std.conv, std.typetuple; int f(string fileName = r"C:\Euler\data\e67.txt") { auto text = read(fileName); return text.length; } vo

Re: Strange behavior of read file

2013-08-27 Thread Paul Jurczak
Correction to my initial post: I oversimplified the code example by snipping too much of context. Here is an example, which fails both on Windows and Linux: module main; import std.stdio, std.file, std.string, std.algorithm, std.range, std.datetime, std.conv, std.typetuple; int e67_1(stri

Strange behavior of read file

2013-08-27 Thread Paul Jurczak
module main; import std.stdio, std.file, std.string, std.algorithm, std.range, std.datetime, std.conv, std.typetuple; int f(string fileName = r"C:\Euler\data\e67.txt") { auto text = read(fileName); return text.length; } void main() { try { string fileName = r"C:\Euler\data\e67.t