I am writing text to the file, but it is not saved, for the test, I decided to read it as a next step, and suddenly the text is displayed, but the file did not change after the program was completed, wherever I used the file using the file, so all streams are closed! Also I wanted to ask why I edit the text file in VS 2017 itself, the changes are not saved (if you just open the file on the desktop). Below are all the screens: Read and Write Code

Here begins the incomprehensible, in the text file recorded "test" (screen below), after clicking, recording and output from the file. I tried to change the properties of the file, but did not help Form and description

Solution Explorer

Text File Properties

Text file itself

The location of the program and the text file

    1 answer 1

    The file "Obj.txt" from the project is not where you open it in the code for writing and reading. Since you do not specify the path to this file, it is written / read in the current directory of the running process. What is different from the location of the file "Obj.txt" added to the project.

    Locate the compiled exe file of your project. Next to it (or a higher level - I don’t remember exactly which folder VS is setting the current one by running the program) you will find another "Obj.txt" with the expected content.