I want to write a vcard file using streamWriter class but I got this exception, what does it means and how to solve it? regards...
The exception is:
FileStream will not open Win32 devices such as disk partitions and tape drives. Avoid use of "\.\" in the path.
private void button1_Click(object sender, EventArgs e)
{
string contactTemplate = "BEGIN:VCARD\nVERSION:3.0\nN:1;mtn;;Mr.;\nFN:mtn 1\nPHOTO;VALUE=URI;TYPE=GIF:http://www.example.com/dir_photos/my_photo.gif \nTEL;TYPE=WORK,VOICE:734641900\nEND:VCARD";
StreamWriter txt = new StreamWriter("E:\\Omar Project\\con.vcf");
txt.Write(contactTemplate);
txt.Close();
}
You can read this warning in the Naming Files, Paths and Namespaces on MSDN
Do not use the following reserved names for the name of a file: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed immediately by an extension; for example, NUL.txt is not recommended. For more information, see Namespaces.
Use a different filename CON is a reserved device name
StreamWriter txt = new StreamWriter("E:\\Omar Project\\CONDATA.vcf");