StreamReader Error -he path is too long

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I created a StreamReader object from a local file on my c:\ drive

StreamReader srTemp = new StreamReader("C:\\myFile.txt")

I then used a RegEx to strip out all the html and save what's left to a string object
So far so good. So now I'm left with just the text

Question

1.When I created a second streamreader object and pass in the name of this string I got this erro

The path is too long after being fully qualified. Make sure path is less than 260 characters.

2. What path is .net talking about

Thank

Mik
2.
 
Hi,

Can you post the code where you create the second StreamReader?

Cheers,
 
Mike said:
I created a StreamReader object from a local file on my c:\ drive.

StreamReader srTemp = new StreamReader("C:\\myFile.txt");

I then used a RegEx to strip out all the html and save what's left
to a string object.
So far so good. So now I'm left with just the text.

Question:

1.When I created a second streamreader object and pass in the name of
this string I got this error

The path is too long after being fully qualified. Make sure path is
less than 260 characters."

2. What path is .net talking about?

The path you've given to the StreamReader - which by the sounds of it
is the text that you read from the previous file.

Why are you creating another StreamReader? Are you really after
StringReader, perhaps?
 
Thank you very much John. I didn't know this object existed

Do you know if its faster, slower or about the same speed as a StreamReader

Mik


----- Jon Skeet [C# MVP] wrote: ----

Mike said:
I created a StreamReader object from a local file on my c:\ drive
to a string object
So far so good. So now I'm left with just the text

The path you've given to the StreamReader - which by the sounds of it
is the text that you read from the previous file

Why are you creating another StreamReader? Are you really after
StringReader, perhaps
 
Mike said:
Thank you very much John. I didn't know this object existed!

Do you know if its faster, slower or about the same speed as a StreamReader?

It's entirely different - it reads character just from memory, from a
string, rather than from whatever stream you give it. I can't imagine
many situations where you'd have the option of using one or the other.
 
Back
Top