Error with some File stream code

Jun 13 2008 5:36 PM

I am having trouble using the filestream object to save a file. I added the trimstar and end to try and fix it incase there were spaces though it dident help. I get an Illegal character in path filename error. The line Console.WriteLine(str); prints it out how it really should look so I am lost!

Thanks for any help.

Jon

string str = SERCOM.ReadTo("%");

str = str.Substring(3);

str.TrimStart(' ');

Console.WriteLine(str);

string vMin = SERCOM.ReadExisting();

TextWriter tw = new StreamWriter(File.Open((@"\\MPI.COM\Production\EP\CNC\" + str.TrimEnd(' ')), FileMode.Create, FileAccess.ReadWrite,FileShare.ReadWrite));

tw.Write("$" + str + "%");

tw.Write(vMin);

tw.Write("%");


Answers (2)