streamwriter - append?

  • Thread starter Thread starter piotrek
  • Start date Start date
P

piotrek

Hi.
I would like to ask if there is a method to force streamwriter.writeline()
to write line at the end of existing file, or should i have write the method
for my own.
PK
 
In order to have StreamWriter.WriteLine() append to a file, you need to
specify that as part of the stream.

If you are creating a StreamWriter directly, you can specify the append
option as an argument to the StreamWriter constructor. Take a look at the
MSDN page for one of those constructors for an example:
http://msdn.microsoft.com/library/d.../frlrfSystemIOStreamWriterClassctorTopic4.asp

If you are creating your StreamWriter from an existing stream, you will need
to specify the FileMode when constructing the stream to be in Append mode.

Brendan
 
Back
Top