digitalmars.D - std.stream
- Paolo Invernizzi <arathorn NOSPAM_fastwebnet.it> Jul 21 2004
- Arcane Jill <Arcane_member pathlink.com> Jul 21 2004
- "Ben Hinkle" <bhinkle mathworks.com> Jul 21 2004
- Sean Kelly <sean f4.ca> Jul 21 2004
- Paolo Invernizzi <arathorn NOSPAM_fastwebnet.it> Jul 21 2004
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...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
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
said anything about fixing it. (Possibly because this is not the bugs
My workaround - don't use std.stream unless you KNOW the file already
Good old fopen() will do the job just fine - OK, so it's not OO and
throw exceptions and so on, but hopefully it's just a temporary workaround
someone 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...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).
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. Sean
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









"Ben Hinkle" <bhinkle mathworks.com> 