Something like this for a file with full path stored in 'path' variable:
StreamWriter writer = null;
if (File.Exists(path))
{
writer = new StreamWriter(path, true);
}
else
{
writer = new StreamWriter(File.Create(path));
}
writer.WriteLine("Nex line or whatever else"));
writer.WriteLine("Another line or whatever");
writer.Close();
Michael
"Wolfgang Meister" <wm******@hotmail.comwrote in message
news:46***********************@newsspool1.arcor-online.net...
>I would like to append text to a file which might exist or not.
What is the easiest way to open or create it depending if it exists or not
and to set it into an "append" text mode?