When adding text to a file, I open the file using the method

StreamWriter^ sw = File::AppendText("testworkfile.txt"); 

Then I start adding information to the file using

 sw->WriteLine("какая Ρ‚ΠΎ информация"); 

everything is fine except that the method after the last entered line creates another empty line, in the file it looks like this:

  информация информация информация | <- пустая строка 

Please answer the following questions:

  1. Is it possible to somehow disable the WriteLine() function to add an empty line?
  2. If not, is it possible to edit the file somehow without full rewriting?

    1 answer 1

    When writing the last line, call the Write method instead of WriteLine .

    • one
      Everything works thank you very much - Amir Shabanov