[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

"Illegal characters in path." error

Allan McLemore

1/10/2003 6:40:00 AM

Hey,

I'm reading a stream of data from a TCP network stream.
The type of data is a fully qualified path to a file
which I try to open. The error I'm getting is:

"Illegal characters in path."

Here is the code:

string file = System.Text.Encoding.Unicode.GetString
(buffer);

// shows C:\Documents and
Settings\Administrator\Desktop\file.txt
MessageBox.Show(file);

// error here:
fileStream = new System.IO.FileStream(file, FileMode.Open);

I've tried .ToString() to the string file before using it
but no luck.

Any ideas what's going on ???

Thank you,
Steve.

1 Answer

(Li-Yan Zhang [MS])

1/13/2003 8:47:00 AM

0

A better way to diagnose this kind of problem is to examine raw bytes for
the variable *buffer*. Sometimes MessageBox is incapable of showing some
non-printable characters and thus is misleading.
Moreover, the following two formats are different in coding:

C:\Documents and Settings\Administrator\Desktop\file.txt
C:\\Documents and Settings\\Administrator\\Desktop\\file.txt

Thanks,
Li-Yan Zhang
VS.NET, Visual C++
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights.
Got .Net? http://www.got...