P
P
pshy_soch2020-06-29 10:34:37
C++ / C#
pshy_soch, 2020-06-29 10:34:37

C# How to write given to txt file line by line?

I have an application in windows form c#.
It has a richTextBox.
How can I write the data from it to a file so that the file is not overwritten?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
freeExec, 2020-06-29
@pshy_soch

When opening a file for writing, you can select the append mode, then the "cursor" is set to the end of the file, and the data begins to be written to the end. It can also be done manually.

D
Developer, 2020-06-29
@samodum

When writing to a file, you must specify the Append attribute instead of Write.
Append - Appends data to the end of an existing file.
Write - overwrites the old file with new data.

V
Vladimir Korotenko, 2020-06-29
@firedragon

And what is the task? So you opened the file and pasted it into the text box. And then what? The reason why you don't want to overwrite the whole file?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question