Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Answer
How To: Write files containing device names
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Arthur McAlister
18y
2.1k
1
Reply
I have an application that exports data from a database. The file names are determined by the information in the database. My code looks like
System.IO.
StreamWriter
sw = System.IO.
File
.CreateText("c:\\temp\\" + dataname + ".txt");
The problem is, some of the data items are the same as system devices. So if I try to write to the file c:\temp\prn.txt I get the error "Filestream will not open Win32 devices such as disk partitions and tape drives. Avoid use of
\\.\
in the path"
Does anyone know how to avoid this problem? I have no control over the data names created in the database and the file names need to match.
Thanks
Spike.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
How to enable Ctrl+C, Ctrl+V, Ctrl+X in a text box?
Name of CustomDocumentProperties