Friday, February 6, 2009

Exception: Filestream will not open win32 devices.... don't use \ "\\\.\\\" in the path

Dim tw As System.IO.StreamWriter = System.IO.File.AppendText("C:\NUL.txt")

The above statement will generate error like: "Filestream will not open win32 devices.... don't use \ "\\\.\\\" in the path"

Reason and Rectification:

Avoid using "CON" or "NUL" like filenames as they are reserved windows device names, you cannot use such words within a filename.

No comments: