
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.
Interestingly even Windows explorer doesn't handle these odd files consistently. Renaming a file to "com1" is ignored with no error, though renaming to "com1.txt" gives an error about such a file already existing. Also, it seems that "com1.txt.txt" is not allowed either. I thought that the extension of "com1.txt.txt" was "txt" but it seems that it is "txt.txt" and so the base name is "com1" and thus not allowed. Duncan