digitalmars.D - std.stream
- Paolo Invernizzi (5/5) Jul 21 2004 Hi all,
- Arcane Jill (11/14) Jul 21 2004 I don't know of any way of doing this /atomically/ on Windows. (It might...
- Ben Hinkle (9/25) Jul 21 2004 see my reply to the bug report on digitalmars.d.bugs for the fix to phob...
- Sean Kelly (5/18) Jul 21 2004 There is a way to fix this. In fact I've already fixed it in my (much
- Paolo Invernizzi (5/12) Jul 21 2004 Ok...
Hi all, What is the best 'D' way for opening a file with std.stream readonly but raise an exception and NOT to create it if it does not exists? --- Paolo Invernizzi
Jul 21 2004
In article <cdlkh2$2jn2$1 digitaldaemon.com>, Paolo Invernizzi says...Hi all, What is the best 'D' way for opening a file with std.stream readonly but raise an exception and NOT to create it if it does not exists?I don't know of any way of doing this /atomically/ on Windows. (It might work on Linux - can't say as I don't use it). This is a bug which has been mentioned before on this forum, but so far no-one's said anything about fixing it. (Possibly because this is not the bugs forum). My workaround - don't use std.stream unless you KNOW the file already exists. Good old fopen() will do the job just fine - OK, so it's not OO and doesn't throw exceptions and so on, but hopefully it's just a temporary workaround until someone in Phobos realizes that READ access should not CREATE, and does something about it. Arcane Jill
Jul 21 2004
see my reply to the bug report on digitalmars.d.bugs for the fix to phobos. "Arcane Jill" <Arcane_member pathlink.com> wrote in message news:cdllva$2khp$1 digitaldaemon.com...In article <cdlkh2$2jn2$1 digitaldaemon.com>, Paolo Invernizzi says...work onHi all, What is the best 'D' way for opening a file with std.stream readonly but raise an exception and NOT to create it if it does not exists?I don't know of any way of doing this /atomically/ on Windows. (It mightLinux - can't say as I don't use it). This is a bug which has been mentioned before on this forum, but so farno-one'ssaid anything about fixing it. (Possibly because this is not the bugsforum).My workaround - don't use std.stream unless you KNOW the file alreadyexists.Good old fopen() will do the job just fine - OK, so it's not OO anddoesn'tthrow exceptions and so on, but hopefully it's just a temporary workarounduntilsomeone in Phobos realizes that READ access should not CREATE, and does something about it. Arcane Jill
Jul 21 2004
Arcane Jill wrote:In article <cdlkh2$2jn2$1 digitaldaemon.com>, Paolo Invernizzi says...There is a way to fix this. In fact I've already fixed it in my (much delayed) stream updates. I'm still bogged down with readf but when that's done I'll finish up the stream stuff. SeanHi all, What is the best 'D' way for opening a file with std.stream readonly but raise an exception and NOT to create it if it does not exists?I don't know of any way of doing this /atomically/ on Windows. (It might work on Linux - can't say as I don't use it). This is a bug which has been mentioned before on this forum, but so far no-one's said anything about fixing it. (Possibly because this is not the bugs forum).
Jul 21 2004
Arcane Jill wrote:This is a bug which has been mentioned before on this forum, but so far no-one's said anything about fixing it. (Possibly because this is not the bugs forum).I was no sure it was a bug ;-)My workaround - don't use std.stream unless you KNOW the file already exists. Good old fopen() will do the job just fine - OK, so it's not OO and doesn't throw exceptions and so on, but hopefully it's just a temporary workaround until someone in Phobos realizes that READ access should not CREATE, and does something about it.Ok... --- Paolo Invernizzi
Jul 21 2004