What am I doing wrong in the following code?
public string ReadFromFile(string text)
{
string toReturn = "";
System.IO.FileStream stream = new System.IO.FileStream(text, System.IO.FileMode.Open);
System.IO.StreamReader reader = new System.IO.StreamReader(text);
toReturn = reader.ReadToEnd();
s...
I am opening a System.Diagnostic.Process to read the stdout from a process and I would like to be able to interrupt it after a certain elapsed time.
try
{
output = outputStream.ReadToEnd();
}
catch (ThreadInterruptedException e)
{
return;
}
That doesn't work since the thread is in the ReadToEnd() method. I attempted to close t...
I have the following text in a file...
blah blah ñ blah
Notice the ñ symbol.
I'm reading this with StreamReader.ReadLine and then trying a string.Replace to replace the special character.
For some reason this isn't working, and it seems to be something to do with the StreamReader. When I inspect the string in the debugger after read...