public static void CreateFile()
{
string str = "test string to stream";
MainClass.WriteOutput(str);
}
public static void WriteOutput(string str)
{
string path = @"C:\marty\CSharp\textfile.txt";
using (StreamWriter stw = new StreamWriter(path))
{
try
{
stw.WriteLine(str);
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}