Saboor Sarfraz wrote:but instead of moving the cursor to the beginning of the current line it moves the cursor to the next line
Nope. A 'file' never ever does that.
Rather you are attempting to display the file using something else.
And that something else, not the file, is doing that.
Saboor Sarfraz wrote:for the purpose of overwriting the existing txt.
Your code is absolutely correct. For what you state the purpose is.
So the problem is, as I stated above.
If you are on a windows machine you can open a Powershell console or a 'cmd' console. They are NOT the same.
Presumably you are using one of those then running your exe.
So try doing it with the other one.
If perhaps you are using an Apple Mac then you are perhaps out of luck since it always interprets the '\r' in the way you are seeing it behave.
modified 21-Nov-23 11:21am.