Avatar of Prysson

asked on 

Help with StreamWriter newline

I am trying to write a class that write a log based on a fairly long routing.

At various instances in the routine I need to pass the logfile name and the string I need written into a method and have it basically start a new line and add the string to the log.txt file.

this is what I have for my method

public static bool WriteLogFile(string filename, string line)
             bool b = false;

                 using (StreamWriter sw = new StreamWriter(filename))
                     // Add some text to the file.                    

                 b = true;

             return b;

So my problem is that this code just keeps overwriting the first line of the log file...anyone know how I can modify this code so it will create a new line and add the string their?


Avatar of undefined
Last Comment

8/22/2022 - Mon