[Haskell-cafe] RE: ANN: System.FilePath 0.9
Duncan Coutts
duncan.coutts at worc.ox.ac.uk
Fri Jul 28 06:16:58 EDT 2006
On Thu, 2006-07-27 at 11:07 -0700, Andrew Pimlott wrote:
> On Wed, Jul 26, 2006 at 04:02:31PM -0700, Andrew Pimlott wrote:
> > I admit I don't know enough to say how the lpt1 issue should be
> > handled. Is there any Win32 call I can make that will help me avoid
> > accidentally opening these magic files? Say, if I call open with
> > O_CREAT | O_EXCL? Unfortunately, I can find very little information on
> > how one should handle this issue.
>
> Thanks to a suggestion from Bulat to use c_open, I was able to test
> O_WRONLY | O_CREAT | O_EXCL on Windows. In fact, Windows does allow
> files like "nul" to be opened (as many times as you like) with these
> flags, which I find dismaying. So I still don't know the proper way to
> handle them.
You can open the file and test the file type with GetFileType. If it's
type FILE_TYPE_CHAR then it's probably not what you wanted.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/getfiletype.asp
Duncan
More information about the Haskell-Cafe
mailing list